Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UInt256

Superficially similar to an ElementModQ, but guaranteed to be exactly 32 bytes long. Use with care, because the internal representation allows for mutation, and the internal representation is available for external use.

Hierarchy

  • UInt256

Implements

Index

Constructors

  • new UInt256(bytes: Uint8Array): UInt256

Properties

bytes: Uint8Array
ONE: UInt256 = ...
TWO: UInt256 = ...
ZERO: UInt256 = ...

Accessors

  • get cryptoHashString(): string

Methods

  • isZero(): boolean
  • Returns whether the given value is all zeros.

    Returns boolean

  • toHex(): string
  • Converts to base-16 big-endian upper-case hex string.

    Returns string

  • toString(): string
  • createFrom(input: string | number | bigint): UInt256
  • Converts the input to a bigint, then to big-endian bytes. If the result is smaller than 32 bytes, the high-bytes will be zero. If the result is greater than 32 bytes, an error is thrown.

    Parameters

    • input: string | number | bigint

    Returns UInt256

  • createFromBytesLeftPad(bytesOrig: Uint8Array): UInt256
  • If the input is smaller than 32 bytes, the low-bytes will be zero. If the input is greater than 32 bytes, an error is thrown.

    Parameters

    • bytesOrig: Uint8Array

    Returns UInt256

  • createFromBytesRightPad(bytesOrig: Uint8Array): UInt256
  • If the input is smaller than 32 bytes, the high-bytes will be zero. If the input is greater than 32 bytes, an error is thrown.

    Parameters

    • bytesOrig: Uint8Array

    Returns UInt256

Generated using TypeDoc