fromhex()

Converts a hexadecimal string to byte array.

Syntax

fromhex(STR_EXPR)
Required Parameters
STR_EXPR
String to be converted to byte array. This option is case-insensitive.

Description

It returns null in the following situations:

  • When the input value is not a hexadecimal string
  • When the string length is odd

Usage

json "{}" 
| eval blob=fromhex("68656c6c6f20776f726c64")
=> 68656c6c6f20776f726c64

json "{}" 
| eval blob=fromhex("616263646") => null

json "{}" | eval blob=fromhex("test") => null

json "{}" | eval blob=fromhex(null) => null