UIntBig

public class UIntBig : Equatable, Hashable, Comparable

Mutable unsigned integer of unlimited size (for 32-bit architectures)

  • Undocumented

    Declaration

    Swift

    public var magnitude: [UInt16]
  • From raw data

    Declaration

    Swift

    public init(_ magnitude: [UInt16])
  • Zero

    Declaration

    Swift

    public convenience init()
  • Positive Int64 value as unlimited value

    Declaration

    Swift

    public convenience init(_ uint64: UInt64)
  • Hex encoded string with format MSB…LSB

    Declaration

    Swift

    public convenience init?(_ hexEncodedString: String)
  • Undocumented

    Declaration

    Swift

    public convenience init?(bitLength: Int, random: PseudoRandomFunction = SecureRandomFunction())
  • Undocumented

    Declaration

    Swift

    public convenience init?(_ data: Data, index: Int = 0)
  • Undocumented

    Declaration

    Swift

    public var data: Data { get }
  • Undocumented

    Declaration

    Swift

    public var hexEncodedString: String { get }
  • Get unsigned long value.

    Declaration

    Swift

    public func uint64() -> UInt64
  • Modular exponentiation r = (a ^ b) % c where

    • a: self
    • b: exponent
    • c: modulus Performance test shows software implementation is acceptably slower than native hardware
    • Test samples = 399,626,333
    • Native 64-bit hardware = 416ns/call
    • Software 32-bit implementation = 3613ns/call

    return r, the result

    Declaration

    Swift

    public func modPow(_ exponent: UIntBig, _ modulus: UIntBig) -> UIntBig

Comparable

  • Compare a and b, ignoring leading zeros

    Declaration

    Swift

    public static func < (lhs: UIntBig, rhs: UIntBig) -> Bool
  • Count of bits based on highest set bit

    Declaration

    Swift

    public func bitLength() -> Int

Equatable

  • Declaration

    Swift

    public static func == (lhs: UIntBig, rhs: UIntBig) -> Bool

Hashable

  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)