• Create a new hash instance, optionally with key, salt and personal. Bypass input assertions by setting noAssert to true.

    All parameters must fulfill the following constraints, or an AssertionError will be thrown (unless noAssert = true):

    • outLength must within the byte ranges defined by the constants below.
    • key is optional, but must within the byte ranges defined by the constants below, if given. This value must be kept secret, and can be used to create prefix-MACs.
    • salt is optional, but must be exactly SALTBYTES, if given. You can use this parameter as a kind of per user id, or local versioning scheme. This value is not required to be secret.
    • personal is optional, but must be exactly PERSONALBYTES, if given. You can use this parameter as a kind of app id, or global versioning scheme. This value is not required to be secret.

    Parameters

    • outLength: number
    • Optional key: Uint8Array
    • Optional salt: Uint8Array
    • Optional personal: Uint8Array
    • Optional noAssert: boolean

      Default

      false
      

    Returns Blake2b

    Example

    import blake2b = require('blake2b')

    const output = new Uint8Array(64)
    const input = Buffer.from('hello world')

    console.log('hash:', blake2b(output.length).update(input).digest('hex'))

Generated using TypeDoc