method

generate_random_hex_key

Importance_1
v7.1.3.2 - Show latest stable - 0 notes - Class: KeyGenerator
generate_random_hex_key(length: key_length) public

Returns a random key in hexadecimal format. The key will have a size in bytes of :length (configured Cipher's length by default)

Hexadecimal format is handy for representing keys as printable text. To maximize the space of characters used, it is good practice including not printable characters. Hexadecimal format ensures that generated keys are representable with plain text

To convert back to the original string with the desired length:

[ value ].pack("H*")
Show source
Register or log in to add new notes.