From 6c688b77c180fe717338eb23998852ff7c30d96d Mon Sep 17 00:00:00 2001 From: Christian Bundy Date: Fri, 4 Sep 2020 08:31:46 -0700 Subject: [PATCH] Use underlying constants instead of redeclaring Problem: The crypto_auth constants are the exact same as some other constants because they refer to the same thing. These shouldn't be re-declared as their own integers. Solution: Refer to the previously declared constants instead of redeclaring. --- crypto_auth.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crypto_auth.js b/crypto_auth.js index 4b4005a..2863e27 100644 --- a/crypto_auth.js +++ b/crypto_auth.js @@ -5,8 +5,6 @@ const Sha256 = require('sha256-universal') const Sha512 = require('sha512-universal') const assert = require('nanoassert') -const crypto_auth_BYTES = 32 -const crypto_auth_KEYBYTES = 32 const crypto_auth_hmacsha256_BYTES = 32 const crypto_auth_hmacsha256_KEYBYTES = 32 const crypto_auth_hmacsha512_BYTES = 64 @@ -14,6 +12,9 @@ const crypto_auth_hmacsha512_KEYBYTES = 32 const crypto_auth_hmacsha512256_BYTES = 32 const crypto_auth_hmacsha512256_KEYBYTES = 32 +const crypto_auth_BYTES = crypto_auth_hmacsha512256_BYTES +const crypto_auth_KEYBYTES = crypto_auth_hmacsha512256_KEYBYTES + function crypto_auth_hmacsha256 (out, input, k) { assert(out.byteLength === crypto_auth_hmacsha256_BYTES, "out should be 'crypto_auth_hmacsha256_BYTES' in length")