1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-03 05:09:14 +00:00

Replace concat-loop padding with string.rep

This commit is contained in:
dmiller
2015-02-27 14:55:42 +00:00
parent e275a96c72
commit 4f0518bd93
10 changed files with 16 additions and 63 deletions

View File

@@ -1456,11 +1456,7 @@ Crypt = {
local key = bin.pack("H", "0123456789abcdef")
-- do padding
if ( #uspw % 8 > 0 ) then
for i=1,(8-(#uspw % 8)) do
uspw = uspw .. "\0"
end
end
uspw = uspw .. string.rep('\0', (8 - (#uspw % 8)) % 8)
local iv2 = openssl.encrypt( "DES-CBC", key, nil, uspw, false ):sub(-8)
local enc = openssl.encrypt( "DES-CBC", iv2, nil, uspw, false ):sub(-8)