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
47064706
47074707local hex_to_bin , bin_to_hex , bin_to_base64 , base64_to_bin
47084708do
4709+ local function repl_hex2bin (hh )
4710+ return char (tonumber (hh , 16 ))
4711+ end
47094712 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 ))
47154714 end
47164715
4716+ local function repl_bin2hex (c )
4717+ return string_format (" %02x" , byte (c ))
4718+ end
47174719 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 ))
47234721 end
47244722
47254723 local base64_symbols = {
You can’t perform that action at this time.
0 commit comments