STRING模块新增一个简易摘要算法,未来保护用户密码明文可能用到

This commit is contained in:
MrZ626
2021-12-06 03:18:41 +08:00
parent 4bafa4bffe
commit 46223e38cd
2 changed files with 20 additions and 0 deletions

View File

@@ -169,6 +169,25 @@ function STRING.vcsDecrypt(text,key)
end
return result..buffer
end
function STRING.digezt(text)--Not powerful hash, just protect the original text
local out={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
local seed=26
for i=1,#text do
local c=byte(text,i)
seed=(seed+c)%26
c=c+seed
local pos=c*i%16
local step=(c+i)%4+1
local times=2+(c%6)
for _=1,times do
out[pos+1]=(out[pos+1]+c)%256
pos=(pos+step)%16
end
end
local result=""
for i=1,16 do result=result..char(out[i])end
return result
end
function STRING.readLine(str)
local p=str:find("\n")