Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Blake2b

import { Blake2b } from "https://raw.githubusercontent.com/marigold-dev/tzstamp/0.3.4/helpers/mod.ts";

BLAKE2b streaming hash function.

const message = new TextEncoder().encode("hello");
const hash = new Blake2b();

hash.update(message);
hash.finalized; // false

hash.digest(); // Uint8Array(32)
hash.finalized; // true
class Blake2b {
constructor(key?: Uint8Array, digestLength?: number);
private buffer: ArrayBuffer;
private counter: number;
private final: boolean;
private offset: bigint;
private state: ArrayBuffer;
readonly digestLength: number;
get finalized(): boolean;
 
private compress(last?): void;
private init(key: Uint8Array): void;
digest(): Uint8Array;
update(input: Uint8Array): this;
 
static digest(
input: Uint8Array,
key?: Uint8Array,
digestLength?: number,
): Uint8Array;
}

§Constructors

§
new Blake2b(key?: Uint8Array, digestLength?: number)
[src]

Throws RangeError if either the key or digest length are larger than 64 bytes, or if the digest length is negative.

@param key

Hash key. Must be between 0-64 bytes.

@param digestLength

Length of digest in bytes, defaulting to 32. Must be between 0-64 bytes.

§Properties

§
buffer: ArrayBuffer
[src]
§
counter: number
[src]
§
final: boolean
[src]
§
offset: bigint
[src]
§
state: ArrayBuffer
[src]
§
digestLength: number
[src]

Length of digest in bytes.

§
finalized: boolean readonly
[src]

Returns true if the hash function is finalized.

§Methods

§
compress(last?): void private
[src]
§
init(key: Uint8Array): void private
[src]
§
digest(): Uint8Array
[src]

Finalizes the state and produces a digest. Throws if the hash function is already finalized.

§
update(input: Uint8Array): this
[src]

Feeds input into the hash function in 128 byte blocks. Throws if the hash function is finalized.

@param input

Input bytes

§Static Methods

§
digest(input: Uint8Array, key?: Uint8Array, digestLength?: number): Uint8Array
[src]

Produces an immediate BLAKE2b digest.

@param input

Input bytes

@param key

Hash key. Must be between 0-64 bytes.

@param digestLength

Length of digest in bytes, defaulting to 32. Must be between 0-64 bytes.