@xo-cash/crypto
    Preparing search index...

    Function createPathIndexFromHash

    • Creates a 31-bit BIP32 non-hardened child index from a SHA256 hash. Reads the first 4 bytes of the hash, interprets them as a little-endian uint32, then masks to 31 bits to guarantee a valid non-hardened index (0 to 2,147,483,647).

      Note: Since only the first 4 bytes of the hash are consumed, two different hashes sharing the same first 4 bytes will derive the same child index and therefore the same signing key. This is an accepted property of this construction.

      Parameters

      • hashBytes: Uint8Array

        A 32-byte SHA256 hash

      Returns number

      Path index (31-bit unsigned integer, 0 to 2,147,483,647)