CCC Docs
    Preparing search index...

    Interface Hasher

    interface Hasher {
        update(data: BytesLike): Hasher;
        digest(): `0x${string}`;
    }

    Implemented by

    Index

    Methods

    Methods

    • Updates the hash with the given data.

      Parameters

      • data: BytesLike

        The data to update the hash with.

      Returns Hasher

      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..."