File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -4706,20 +4706,18 @@ end
4706
4706
4707
4707
local hex_to_bin , bin_to_hex , bin_to_base64 , base64_to_bin
4708
4708
do
4709
+ local function repl_hex2bin (hh )
4710
+ return char (tonumber (hh , 16 ))
4711
+ end
4709
4712
function hex_to_bin (hex_string )
4710
- return (gsub (hex_string , " %x%x" ,
4711
- function (hh )
4712
- return char (tonumber (hh , 16 ))
4713
- end
4714
- ))
4713
+ return (gsub (hex_string , " %x%x" , repl_hex2bin ))
4715
4714
end
4716
4715
4716
+ local function repl_bin2hex (c )
4717
+ return string_format (" %02x" , byte (c ))
4718
+ end
4717
4719
function bin_to_hex (binary_string )
4718
- return (gsub (binary_string , " ." ,
4719
- function (c )
4720
- return string_format (" %02x" , byte (c ))
4721
- end
4722
- ))
4720
+ return (gsub (binary_string , " ." , repl_bin2hex ))
4723
4721
end
4724
4722
4725
4723
local base64_symbols = {
You can’t perform that action at this time.
0 commit comments