toHex

fun toHex(bytes: ByteArray, upperCase: Boolean = false, byteDivider: String = "", decodeAsString: Boolean = false): String

Encodes a byte array into hexadecimal numbers.

The returned string can be decoded using the fromHex method.

Return

a string with hexadecimal numbers optionally separated by byteDivider.

Parameters

bytes

the byte array to encode.

upperCase

if true, will use upper-case characters, otherwise lower-case is used.

byteDivider

a string to separate bytes (hex pairs).

decodeAsString

if true, will include the value decoded as a string with only printable characters.