Binary Decode
Synopsis
Decodes binary strings (e.g., "01000001") to ASCII (e.g., "A").
Schema
- binary_decode:
field: <ident>
target_field: <string>
input_format: <string>
output_format: <string>
encoding: <string>
bits_per_char: <integer>
delimiter: <string>
description: <text>
if: <script>
ignore_failure: <boolean>
ignore_missing: <boolean>
on_failure: <processor[]>
on_success: <processor[]>
tag: <string>
Configuration
The following fields are used to define the processor:
Field | Required | Default | Description |
---|---|---|---|
field | Y | - | Source field containing binary data to decode |
target_field | N | Same as field | Target field to store decoded result |
input_format | N | binary | Input data format: binary , hex , decimal , octal |
output_format | N | string | Output format: string , hex , decimal , bytes |
encoding | N | utf8 | Character encoding: utf8 , ascii , utf16le , utf16be |
bits_per_char | N | 8 (or 7 for ASCII) | Number of bits per character |
delimiter | N | - | Custom delimiter for binary string separation |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | Continue processing if decoding fails |
ignore_missing | N | false | Skip processing if referenced field doesn't exist |
on_failure | N | - | See Handling Failures |
on_success | N | - | See Handling Success |
tag | N | - | Identifier |
Details
Converts binary data from various input formats to specified output formats. The processor supports multiple input formats including binary strings, hexadecimal, decimal, and octal representations.
The processor automatically handles common separators in binary strings (spaces, commas, dashes, underscores) and can process both individual strings and arrays of strings.
When processing binary strings, the processor automatically pads input with leading zeros if the string length is not a multiple of bits_per_char
. This ensures proper character alignment.
The encoding
parameter determines how the decoded bytes are interpreted as characters. UTF-8 is the default and most common encoding, while ASCII is limited to 7-bit characters.
If the input contains invalid characters for the specified format (e.g., non-binary digits in binary format), the processor will fail unless ignore_failure
is set to true
.
Examples
Basic Binary to ASCII
Converting binary string to ASCII text... |
|
decodes to readable text: |
|
Hexadecimal Input
Converting hexadecimal to ASCII string... |
|
converts hex to readable text: |
|
Spaced Binary String
Processing binary with space separators... |
|
automatically handles separators: |
|
Array Processing
Decoding multiple binary strings from array... |
|
processes each array element: |
|
Output to Hex Format
Converting binary input to hex output... |
|
outputs in hexadecimal format: |
|