Options
All
  • Public
  • Public/Protected
  • All
Menu

SHA2-256 cryptographic hash algorithm.

Hierarchy

  • SHA256

Implements

  • SerializableHash

Index

Constructors

constructor

Properties

Protected _state

_state: Int32Array = new Int32Array(8)

blockSize

blockSize: number = BLOCK_SIZE

Block size

digestLength

digestLength: number = DIGEST_LENGTH

Length of hash output

Methods

Protected _initState

  • _initState(): void

clean

  • clean(): void

cleanSavedState

digest

  • digest(): Uint8Array

finish

  • finish(out: Uint8Array): this
  • Finalizes hash state and puts hash into out. If hash was already finalized, puts the same value.

    Parameters

    • out: Uint8Array

    Returns this

reset

  • reset(): this
  • Resets hash state making it possible to re-use this instance to hash other data.

    Returns this

restoreState

  • Function useful for HMAC/PBKDF2 optimization. Restores state saved by saveState() and sets bytesHashed to the given value.

    Parameters

    Returns this

saveState

  • Function useful for HMAC/PBKDF2 optimization. Returns hash state to be used with restoreState(). Only chain value is saved, not buffers or other state variables.

    Returns SavedState

update

  • update(data: Uint8Array, dataLength?: number): this
  • Updates hash state with the given data.

    Throws error when trying to update already finalized hash: instance must be reset to update it again.

    Parameters

    • data: Uint8Array
    • Default value dataLength: number = data.length

    Returns this

Generated using TypeDoc