1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-24 00:19:01 +00:00

Use string.gsub instead of looped concat to modify strings

This commit is contained in:
dmiller
2015-02-27 14:55:29 +00:00
parent d16772a8a8
commit e275a96c72
5 changed files with 23 additions and 42 deletions

View File

@@ -86,11 +86,8 @@ Util = {
182,128,158,208,162,132,167,209,149,241,153,251,237,236,171,195,
243,233,253,240,194,250,191,155,142,137,245,235,163,242,178,152 };
local result = ""
for i = 1, #password do
result = result .. string.char(shifts[password:byte(i)+1])
end
return 'A' .. result
return 'A' .. string.gsub(password, ".",
function(c) return string.char(shifts[c:byte()+1]) end)
end
}