Fix of recognition of ArrayBuffer parameters

If js-sha3 is loaded using 'webpack' loader then the top-most
fuction is not called with global object (`global` in node,
`window` in browsers) and thus `root.ArrayBuffer` is undefined.

This patch introduces usage of `ArrayBuffer` without `root`
prefix similary to how e.g. `Uint8Array` is already used.
pull/10/head
happylynx 9 years ago
parent ec2a9948f9
commit 9f8c2a3fb3

@ -106,7 +106,7 @@
Keccak.prototype.update = function (message) {
var notString = typeof message != 'string';
if (notString && message.constructor == root.ArrayBuffer) {
if (notString && message instanceof ArrayBuffer) {
message = new Uint8Array(message);
}
var length = message.length, blocks = this.blocks, byteCount = this.byteCount,

Loading…
Cancel
Save