CCC Docs
    Preparing search index...

    Implements

    Index

    Constructors

    Methods

    Constructors

    • Creates an instance of Hasher.

      Parameters

      • outLength: number = 32

        The output length of the hash in bytes. Default is 32.

      • personal: string = CKB_BLAKE2B_PERSONAL

        The personal string for the Blake2b algorithm. Default is CKB_BLAKE2B_PERSONAL.

      Returns HasherCkb

    Methods

    • Updates the hash with the given data.

      Parameters

      • data: BytesLike

        The data to update the hash with.

      Returns HasherCkb

      The current Hasher instance for chaining.

      const hasher = new Hasher();
      hasher.update("some data").update("more data");
      const hash = hasher.digest();
    • Finalizes the hash and returns the digest as a hexadecimal string.

      Returns `0x${string}`

      The hexadecimal string representation of the hash.

      const hasher = new Hasher();
      hasher.update("some data");
      const hash = hasher.digest(); // Outputs something like "0x..."