BytesRepresentationConverter
internal final class BytesRepresentationConverter
Utility class for converting between binary and hexadecimal representations.
-
Convert a hexadecimal number to a binary representation.
Declaration
Swift
internal static func convertToBinaryRepresentation(from hex: HexadecimalNumber, withAtLeastHexDigits hexDigits: Int = 2) -> BinaryRepresentationParameters
hexThe hexadecimal number (
UInt64) to convert.hexDigitsThe minimum number of hexadecimal digits to consider (default is 2).
Return Value
A binary representation (
[UInt8]). -
Convert a hexadecimal representation to a binary representation.
Declaration
Swift
internal static func convertToBinaryRepresentation(from hex: HexRepresentation) -> BinaryRepresentationParameters
hexThe hexadecimal representation (
String) to convert.Return Value
A binary representation (
[UInt8]).
-
Convert a byte to a hexadecimal representation.
Declaration
Swift
internal static func convertToHexRepresentation(from byte: Byte) -> HexRepresentationParameters
byteThe 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>) -> HexRepresentationParameters
bytesThe 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) -> HexRepresentationParameters
bytesThe 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) -> HexRepresentationParameters
hexThe hexadecimal number (
UInt64) to convert.Return Value
A hexadecimal representation (
String).
-
Convert a byte to a hexadecimal number.
Declaration
Swift
internal static func convertToHexNumber(from byte: Byte) -> HexadecimalNumberParameters
byteThe 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>) -> HexadecimalNumberParameters
bytesThe 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) -> HexadecimalNumberParameters
bytesThe sequence of bytes (
[UInt8]) to convert.Return Value
A hexadecimal number (
UInt64).
View on GitHub
BytesRepresentationConverter Class Reference