encoding
Subcommands
| Subcommand | Description | Syntax |
|---|---|---|
hexencode | Encodes data into hexadecimal format | hexencode(<expr>) |
hexdecode | Decodes data in hexadecimal format | hexdecode(<expr>) |
b64encode | Encodes data into base64 format | b64encode(<expr>) |
b64decode | Decodes data in base64 format | b64decode(<expr>) |
urlencode | URL-encodes a string | urlencode(<expr>) |
urldecode | Decodes data in URL-encoded format | urldecode(<expr>) |
Examples
hexencode
For a field data containing hello, this example sets encoded to 68656c6c6f:
| eval encoded=hexencode(data)
hexdecode
For a field data containing 68656c6c6f, this example sets decoded to hello:
| eval decoded=hexdecode(data)
b64encode
For a field data containing hello, this example sets encoded to aGVsbG8=:
| eval encoded=b64encode(data)
b64decode
For a field data containing aGVsbG8=, this example sets decoded to hello:
| eval decoded=b64decode(data)
urlencode
For a field url containing https://example.com?q=test&foo=bar, this example sets encoded to https%3A%2F%2Fexample.com%3Fq%3Dtest%26foo%3Dbar:
| eval encoded=urlencode(url)
urldecode
For a field encoded containing https%3A%2F%2Fexample.com%3Fq%3Dtest%26foo%3Dbar, this example sets decoded to https://example.com?q=test&foo=bar:
| eval decoded=urldecode(encoded)