BytesRepresentationConverter

internal final class BytesRepresentationConverter

Utility class for converting between binary and hexadecimal representations.

Convert to Binary Representation

Convert to Hex Representation

  • Convert a byte to a hexadecimal representation.

    Declaration

    Swift

    internal static func convertToHexRepresentation(from byte: Byte) -> HexRepresentation

    Parameters

    byte

    The byte (UInt8) to convert.

    Return Value

    A hexadecimal representation (String).

  • Convert a slice of bytes to a hexadecimal representation.

    Declaration

    Swift

    internal static func convertToHexRepresentation(from bytes: ArraySlice<Byte>) -> HexRepresentation

    Parameters

    bytes

    The slice of bytes (ArraySlice<UInt8>) to convert.

    Return Value

    A hexadecimal representation (String).

  • Convert a sequence of bytes to a hexadecimal representation.

    Declaration

    Swift

    internal static func convertToHexRepresentation(from bytes: BinaryRepresentation) -> HexRepresentation

    Parameters

    bytes

    The sequence of bytes ([UInt8]) to convert.

    Return Value

    A hexadecimal representation (String).

  • Convert a hexadecimal number to a hexadecimal representation.

    Declaration

    Swift

    internal static func converToHexRepresentation(from hex: HexadecimalNumber) -> HexRepresentation

    Parameters

    hex

    The hexadecimal number (UInt64) to convert.

    Return Value

    A hexadecimal representation (String).

Convert to Hex Number

  • Convert a byte to a hexadecimal number.

    Declaration

    Swift

    internal static func convertToHexNumber(from byte: Byte) -> HexadecimalNumber

    Parameters

    byte

    The byte (UInt8) to convert.

    Return Value

    A hexadecimal number (UInt64).

  • Convert a slice of bytes to a hexadecimal number.

    Declaration

    Swift

    internal static func convertToHexNumber(from bytes: ArraySlice<Byte>) -> HexadecimalNumber

    Parameters

    bytes

    The slice of bytes (ArraySlice<UInt8>) to convert.

    Return Value

    A hexadecimal number (UInt64).

  • Convert a sequence of bytes to a hexadecimal number.

    Declaration

    Swift

    internal static func convertToHexNumber(from bytes: BinaryRepresentation) -> HexadecimalNumber

    Parameters

    bytes

    The sequence of bytes ([UInt8]) to convert.

    Return Value

    A hexadecimal number (UInt64).