16 |
16 |
17 local function H(str) |
17 local function H(str) |
18 return crypto.digest("sha1", str, true); |
18 return crypto.digest("sha1", str, true); |
19 end |
19 end |
20 |
20 |
|
21 local _hmac_digest = crypto.hmac.digest; |
21 local function HMAC(key, str) |
22 local function HMAC(key, str) |
22 return crypto.hmac.digest("sha1", str, key, true); |
23 return _hmac_digest("sha1", str, key, true); |
23 end |
24 end |
24 |
25 |
25 local function Hi(str, salt, i) |
26 local function Hi(str, salt, i) |
26 local U = HMAC(str, salt .. "\0\0\0\1"); |
27 local U = HMAC(str, salt .. "\0\0\0\1"); |
27 local ret = U; |
28 local ret = U; |