in src/ecdh.js [115:162]
hashit: function(sha, A, n, B, pad) {
var R = [],
H, W, i, len;
if (sha == this.SHA256) {
H = new ctx.HASH256();
} else if (sha == this.SHA384) {
H = new ctx.HASH384();
} else if (sha == this.SHA512) {
H = new ctx.HASH512();
}
if (n > 0) {
H.process_num(n);
}
if (B != null) {
H.process_array(B);
}
R = H.hash();
if (R.length == 0) {
return null;
}
if (pad == 0) {
return R;
}
W = [];
len = pad;
if (sha >= len) {
for (i = 0; i < len; i++) {
W[i] = R[i];
}
} else {
for (i = 0; i < sha; i++) {
W[i + len - sha] = R[i];
}
for (i = 0; i < len - sha; i++) {
W[i] = 0;
}
}
return W;
},