STRING模块新增一个简易摘要算法,未来保护用户密码明文可能用到
This commit is contained in:
@@ -169,6 +169,25 @@ function STRING.vcsDecrypt(text,key)
|
|||||||
end
|
end
|
||||||
return result..buffer
|
return result..buffer
|
||||||
end
|
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)
|
function STRING.readLine(str)
|
||||||
local p=str:find("\n")
|
local p=str:find("\n")
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ local function _login()
|
|||||||
elseif #password==0 then
|
elseif #password==0 then
|
||||||
MES.new('error',text.noPassword)return
|
MES.new('error',text.noPassword)return
|
||||||
end
|
end
|
||||||
|
-- password=STRING.digezt(password)
|
||||||
NET.wsconn_user_pswd(email,password)
|
NET.wsconn_user_pswd(email,password)
|
||||||
if savePW then
|
if savePW then
|
||||||
saveFile({email,password},'conf/account')
|
saveFile({email,password},'conf/account')
|
||||||
|
|||||||
Reference in New Issue
Block a user