To Hex

Category: Encoding

Status: Registered and callable in the CyberChef 11.3.0 compatibility inventory.

Input / output: ArrayBuffer → string

Background: https://wikipedia.org/wiki/Hexadecimal

What it does

Converts the input string to hexadecimal bytes separated by the specified delimiter. e.g. The UTF-8 encoded string Γειά σου becomes ce 93 ce b5 ce b9 ce ac 20 cf 83 ce bf cf 85 0a

Note

Status here means the operation name is implemented and callable. It does not by itself promise byte-for-byte parity for every upstream option. See Compatibility and current status for the verified scope and known boundaries.

Arguments and options

Arguments are positional. Keep their order when using bake() or Pipeline.then().

Index

Name

UI type

PyChef default

Accepted values / format

0

Delimiter

option

'Space'

'Space', 'Percent', 'Comma', 'Semi-colon', 'Colon', 'Line feed', 'CRLF', '0x', '0x with comma', '\\x', 'None'

1

Bytes per line

number

0

A Python integer or floating-point value

Working recipe example

from pychef import bake

input_value = b"ABC"
args = ['None', 0]
result = bake(input_value, [{"op": 'To Hex', "args": args}])
print(result)

Expected representation: 414243.

Pipeline example

from pychef import Pipeline

args = ['None', 0]
transform = Pipeline().then('To Hex', *args)
result = transform(b"ABC")

Dedicated operation module

The registered entry point lives in pychef.operations.by_operation.to_hex. Direct calls receive the input value and a positional argument tuple:

from pychef.operations.by_operation.to_hex import run

result = run(b"ABC", tuple(['None', 0]))
pychef.operations.by_operation.to_hex.run(value, args)

Run this operation using its shared internal implementation.

Parameters:
  • value (str | bytes)

  • args (Sequence[Any])

Return type:

str | bytes