in src/ecdh.js [317:369]
HMAC: function(sha, M, K, tag) {
/* Input is from an octet m *
* olen is requested output length in bytes. k is the key *
* The output is the calculated tag */
var olen = tag.length,
B = [],
b = 64,
K0, i;
if (sha > 32) {
b = 128;
}
K0 = new Array(b);
//b=K0.length;
if (olen < 4) {
return 0;
}
for (i = 0; i < b; i++) {
K0[i] = 0;
}
if (K.length > b) {
B = this.hashit(sha, K, 0, null, 0);
for (i = 0; i < sha; i++) {
K0[i] = B[i];
}
} else {
for (i = 0; i < K.length; i++) {
K0[i] = K[i];
}
}
for (i = 0; i < b; i++) {
K0[i] ^= 0x36;
}
B = this.hashit(sha, K0, 0, M, 0);
for (i = 0; i < b; i++) {
K0[i] ^= 0x6a;
}
B = this.hashit(sha, K0, 0, B, olen);
for (i = 0; i < olen; i++) {
tag[i] = B[i];
}
return 1;
},