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.
This commit is contained in:
Christian Bundy 2020-09-04 08:31:46 -07:00 committed by Christophe Diederichs
parent e1087aa973
commit 6c688b77c1

View File

@ -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")