From 311905883ae922c07182af3859e499aa1340b714 Mon Sep 17 00:00:00 2001 From: Christophe Diederichs Date: Sat, 23 May 2020 13:37:54 +0200 Subject: [PATCH] update: crypto_hash --- crypto_hash.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/crypto_hash.js b/crypto_hash.js index 8dc7144..5b6d445 100644 --- a/crypto_hash.js +++ b/crypto_hash.js @@ -1,6 +1,9 @@ -module.exports = { - crypto_hash, - crypto_hash_BYTES +const sha256 = require('sha256-wasm') + +var crypto_hash_sha256_BYTES = 32 + +function crypto_hash_sha256 (output, input) { + return sha256().update(input).digest(output) } var K = [ @@ -459,3 +462,10 @@ function crypto_hash (out, m, n) { } var crypto_hash_BYTES = 64 + +module.exports = { + crypto_hash, + crypto_hash_sha256, + crypto_hash_BYTES, + crypto_hash_sha256_BYTES +}