@technobuddha/library
Version:
A large library of useful functions
41 lines (40 loc) • 1.2 kB
TypeScript
import { ShaBase } from './sha-base.ts';
/**
* Secure Hash Algorithm, SHA2 SHA-256
* @example
* ```typescript
* const sha256 = new Sha256();
* sha256.update('hello world', 'utf8');
* sha256.digest('hex');
* // 'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9'
* ```
* ```typescript
* const sha256 = new Sha256();
* sha256.update(new Uint8Array([0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64]));
* sha256.digest('hex');
* // 'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9'
* ```
* @group Binary
* @category Hash
*/
export declare class Sha256 extends ShaBase {
private a;
private b;
private c;
private d;
private e;
private f;
private g;
private h;
private readonly w;
/**
* Creates a new SHA-256 hash instance and initializes its internal state.
*
* @remarks
* The internal state variables are set to the initial SHA-256 constants as specified
* in FIPS PUB 180-4. Use {@link update} to process data and {@link digest} to retrieve the hash.
*/
constructor();
protected updateCounters(buffer: Uint8Array): void;
protected hash(): Uint8Array;
}