Skip to content

bigIntFromBytesBe

bigIntFromBytesBe(bytes): bigint

Defined in: packages/core/src/big-int/from-bytes-be.ts:13

Decodes two’s complement, big-endian bytes back into a bigint — the inverse of bigIntToBytesBe.

The high bit of the first byte is the sign, so any width round-trips: 0xff and 0xff_ff both decode to -1. Reach for bigIntFromBytesLe when the least significant byte comes first.

Time complexity: O(n) in the byte count.

Uint8Array

The encoding. An empty input decodes to zero.

bigint