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

Sha256

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

SHA-256 streaming hash function.

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

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

hash.digest(); // Uint8Array(32)
hash.finalized; // true
class Sha256 {
constructor();
private buffer: ArrayBuffer;
private counter: number;
private final: boolean;
private size: bigint;
private state: ArrayBuffer;
get finalized(): boolean;
 
private compress(): void;
digest(): Uint8Array;
update(input: Uint8Array): this;
 
static digest(input: Uint8Array): Uint8Array;
}

§Constructors

§
new Sha256()
[src]

§Properties

§
buffer: ArrayBuffer
[src]
§
counter: number
[src]
§
final: boolean
[src]
§
size: bigint
[src]
§
state: ArrayBuffer
[src]
§
finalized: boolean readonly
[src]

Returns true if the hash function is finalized.

§Methods

§
compress(): void private
[src]
§
digest(): Uint8Array
[src]

Finalizes the state and produces a digest.

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

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

@param input

Input bytes

§Static Methods

§
digest(input: Uint8Array): Uint8Array
[src]

Produces an immediate SHA-256 digest.

@param input

Input bytes