crypto_sign: replace Buffer.alloc() with new Uint8Array() (#62)

This commit is contained in:
Kasper Isager Dalsgarð 2021-11-04 18:17:13 +01:00 committed by GitHub
parent 87ff2a56bd
commit 25c97802f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -452,7 +452,7 @@ function crypto_sign_ed25519_sk_to_curve25519 (curveSk, edSk) {
assert(curveSk && curveSk.byteLength === crypto_scalarmult_BYTES, "curveSk must be 'crypto_sign_SECRETKEYBYTES' long") assert(curveSk && curveSk.byteLength === crypto_scalarmult_BYTES, "curveSk must be 'crypto_sign_SECRETKEYBYTES' long")
assert(edSk && edSk.byteLength === crypto_sign_ed25519_SECRETKEYBYTES, "edSk must be 'crypto_sign_ed25519_SECRETKEYBYTES' long") assert(edSk && edSk.byteLength === crypto_sign_ed25519_SECRETKEYBYTES, "edSk must be 'crypto_sign_ed25519_SECRETKEYBYTES' long")
var h = Buffer.alloc(crypto_hash_sha512_BYTES) var h = new Uint8Array(crypto_hash_sha512_BYTES)
crypto_hash(h, edSk, 32) crypto_hash(h, edSk, 32)
h[0] &= 248 h[0] &= 248