Software /
code /
verse
Comparison
util/sasl/scram.lua @ 363:056ccefa6acf
util.sasl.scram: Slight optimization of HMAC
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 30 Sep 2014 12:16:33 +0200 |
parent | 362:d8c3e94d765d |
child | 365:48bf6993b4c4 |
comparison
equal
deleted
inserted
replaced
362:d8c3e94d765d | 363:056ccefa6acf |
---|---|
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; |