Blake2b-JS
A JavaScript (ES6) implementation of the Blake2b-512 cryptographic hash function.
Usage
1. Download the library
npm i --save @rabbit-company/blake2b
2. Import the library
import Blake2b from "@rabbit-company/blake2b";
3. Generate a Hash
Blake2b.hash("message");
Blake2b.hash("message", "secretKey");
Blake2b.hash("message", "secretKey", 32);
Blake2b.hash("message", "secretKey", 32, "c32df5f2f3c77a03");
Blake2b.hash(
"message",
"secretKey",
32,
"c32df5f2f3c77a03",
"4862f0260a9803da"
);
Parameters
- message: The input to be hashed. Can be a string or a Uint8Array.
- secret: (Optional) A secret key for HMAC mode. Can be a string or Uint8Array. If not provided, a standard Blake2b hash will be generated.
- length: (Optional) The length of the output hash in bytes. Defaults to 64. Must be between 1 and 64.
- salt: (Optional) A salt value for the hash. Must be a 16-byte string or Uint8Array.
- personal: (Optional) A personalization string for the hash. Must be a 16-byte string or Uint8Array.