[UInt8]

An extension to arrays of UInt8 that provides exclusive OR (XOR) functionality and a random generator of a specified size.

  • Perform an exclusive OR (XOR) operation between two byte arrays.

    Declaration

    Swift

    static func xor(_ rhs: [UInt8], _ lhs: [UInt8]) -> [UInt8]

    Parameters

    rhs

    The right-hand side byte array.

    lhs

    The left-hand side byte array.

    Return Value

    The result of the XOR operation as a byte array.

  • Perform an exclusive OR (XOR) operation between this byte array and another.

    Declaration

    Swift

    func xor(_ other: [UInt8]) -> [UInt8]

    Parameters

    other

    The other byte array to XOR with.

    Return Value

    The result of the XOR operation as a byte array.

  • Initialize a byte array with random values of a specified size.

    Declaration

    Swift

    init(randomOfSize size: Int)

    Parameters

    size

    The size of the random byte array.

  • Initialize a [UInt8] from an integer value.

    Declaration

    Swift

    init(from integerValue: Int, removePadding: Bool)

    Parameters

    integerValue

    The integer value to use for initializing the array.

    removePadding

    A boolean flag that specifies whether to remove leading zeros from the value.

    Return Value

    A [UInt8] initialized with the provided integer value.