(key, data)
| 514 | * Calculate the HMAC-SHA1 of a key and some data |
| 515 | */ |
| 516 | function core_hmac_sha1(key, data) { |
| 517 | var bkey = str2binb(key); |
| 518 | if (bkey.length > 16) { bkey = core_sha1(bkey, key.length * chrsz); } |
| 519 | |
| 520 | var ipad = Array(16), |
| 521 | opad = Array(16); |
| 522 | for (var i = 0; i < 16; i++) { |
| 523 | ipad[i] = bkey[i] ^ 0x36363636; |
| 524 | opad[i] = bkey[i] ^ 0x5C5C5C5C; |
| 525 | } |
| 526 | |
| 527 | var hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz); |
| 528 | return core_sha1(opad.concat(hash), 512 + 160); |
| 529 | } |
| 530 | |
| 531 | /* |
| 532 | * Add integers, wrapping at 2^32. This uses 16-bit operations internally |
no test coverage detected
searching dependent graphs…