From 5dfe656dc5d917d0d7a68da8a497472149f7ab25 Mon Sep 17 00:00:00 2001 From: Christophe Diederichs Date: Tue, 23 May 2023 16:44:50 +0100 Subject: [PATCH] ad tweak to ed-wasm test --- ed-wasm.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ed-wasm.js b/ed-wasm.js index 9636bec..f09b5d6 100644 --- a/ed-wasm.js +++ b/ed-wasm.js @@ -5,6 +5,7 @@ const { crypto_sign, crypto_sign_open, crypto_sign_verify_detached } = require(' const sign = require('./crypto_sign') const ed = require('./ed25519') const ec = require('./fe25519_25') +const { crypto_tweak_ed25519 } = require('./crypto_tweak') console.log(crypto_scalarmult_ed25519) let sm = Buffer.alloc(1024 + sodium.crypto_sign_BYTES) @@ -154,6 +155,16 @@ console.log('native', res.toString('hex')) crypto_scalarmult_ed25519(res, fixtures[1].sk, fixtures[1].pk) console.log(res.toString('hex')) +const tweak = Buffer.alloc(32) +const ns = Buffer.alloc(32) + +native.crypto_generichash(ns, Buffer.from('namespace')) +crypto_tweak_ed25519(tweak, fixtures[1].pk, ns) +console.log('js', tweak.toString('hex')) + +native.experimental_crypto_tweak_ed25519(tweak, fixtures[1].pk, ns) +console.log('native', tweak.toString('hex')) + // const a = Buffer.alloc(32) // a[i] = 9 // crypto_scalarmult_curve25519_base(res, an)