From 78f7c7111c5c1bb4ddc51f915be0611fb36e5418 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 12 Jun 2017 10:15:52 +0200 Subject: [PATCH] add wasm info --- crypto_generichash.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crypto_generichash.js b/crypto_generichash.js index b347aff..cf7694a 100644 --- a/crypto_generichash.js +++ b/crypto_generichash.js @@ -7,11 +7,16 @@ module.exports.crypto_generichash_BYTES = blake2b.BYTES module.exports.crypto_generichash_KEYBYTES_MIN = blake2b.KEYBYTES_MIN module.exports.crypto_generichash_KEYBYTES_MAX = blake2b.KEYBYTES_MAX module.exports.crypto_generichash_KEYBYTES = blake2b.KEYBYTES +module.exports.crypto_generichash_WASM_SUPPORTED = blake2b.WASM_SUPPORTED +module.exports.crypto_generichash_WASM_LOADED = false + module.exports.crypto_generichash = function (output, input, key) { blake2b(output.length, key).update(input).final(output) } +module.exports.crypto_generichash_ready = blake2b.ready + module.exports.crypto_generichash_batch = function (output, inputArray, key) { var ctx = blake2b(output.length, key) for (var i = 0; i < inputArray.length; i++) { @@ -24,3 +29,7 @@ module.exports.crypto_generichash_instance = function (key, outlen) { if (outlen == null) outlen = module.exports.crypto_generichash_BYTES return blake2b(outlen, key) } + +blake2b.ready(function (err) { + if (blake2b.WASM_SUPPORTED) module.exports.crypto_generichash_WASM_LOADED = !err +})