Hexbinhex
Six utility programs to convert between hex, binary, ascii-binary and the oddball NIST format for 90B testing. The hex output is more compact than hexdump or od -x.
Install / Use
/learn @dj-on-github/HexbinhexREADME
A set of binary, hex, ascii binary and nist format converters.
$ hex2bin -h Usage: hex2bin [-h][-s lines_to_skip][-o <out filename>][filename] -s n Skip the first n lines of the input text -o filename Output to file filename instead of stdout
Convert hexadecimal data to binary. Author: David Johnston, dj@deadhat.com
$ bin2hex -h Usage: bin2hex [-w <width>][-h][-o <out filename>] [filename]
Convert binary data to hexadecimal. Author: David Johnston, dj@deadhat.com
$ bin201 -h Usage: bin201 [-w <width>][-b][-h][-o <out filename>] [filename] -w <width> Sets the number of bits per output line -B Reverses the order of bits in each byte to big endian -L Outputs bits as little endian (default) Convert binary data to ascii binary (01001001). Author: David Johnston, dj@deadhat.com
$ 012bin -h Usage: 012bin [-h][-B][-L][-o <out filename>] [filename] -B Treats bits as big endian -L Treats bits as little endian (default) Convert ascii binary (01001001) to binary data. Author: David Johnston, dj@deadhat.com
$ bin2nistoddball -h Usage: bin2nistoddball [-l <bits_per_symbol 1-8>][-B|-L][-v][-h][-o <out filename>] [filename] -l , --length <bits_per_symbol 1-8> Set the number of bits to encode in eat output byte -r , --reverse Interpret input binary data as big endian (MSB first) (default is little endian) -B , --bigendian Unpack output multi-bit symbols as big-endian (msb first) -L , --littleendian Unpack output multi-bit symbols as little-endian (lsb first) (default) -v , --verbose Output information to stderr -h , --help Output this information
Convert binary data to NIST Oddball SP800-90B one-symbol-per-byte format. Author: David Johnston, dj@deadhat.com
$ nistoddball2bin -h Usage: nistoddball2bin [-l <bits_per_symbol 1-8>][-B|-L][-v][-h][-o <out filename>] [filename] -l n Set the number of symbol bits per byte encoded in the input data. Must be between 1 to 8 -B Interpret the input symbols at being big endian (MSB first) -L Interpret the input symbols at being little endian (LSB first) (default) -v Verbose mode. Outputs information to stderr -h Display this information -o filename Output to file filename instead of stdout
Convert binary data to NIST Oddball SP800-90B one-symbol-per-byte format. Author: David Johnston, dj@deadhat.com
Notes: The NIST format for SP800-90B testing requires symbols to be as one symbol per byte. This means only symbols of sizes 1 through 8 bits can be supported. The bit ordering of the bits within the symbols is not specified by NIST. The -L and -B options allow you to choose. The output binary data by default is in little endian format, with the lower order bits in bytes coming before higher order bits. This can be reversed with the -r option.
Two programs to convert between hex and binary format. bin2hex exists because it has a more compact output format than od or hexdump. hex2bin exists just for the sake of symmetry.
bin2nistoddball converts binary to the oddball one-symbol-per-byte format used by the NIST SP800-90B sofware. nistoddball2bin does the reverse.
bin201 converts binary to ASCII binary
012bin converts ASCII binary to binary
Examples:
$ cat hexfile.hex 0001020304050607 08090a0b0c0d0e0f 1011121314151617 18191a1b1c1d1e1f
$ hex2bin hexfile.hex | bin2hex 000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F
$ hex2bin hexfile.hex | bin201 00000000100000000100000011000000 00100000101000000110000011100000 00010000100100000101000011010000 00110000101100000111000011110000 00001000100010000100100011001000 00101000101010000110100011101000 00011000100110000101100011011000 00111000101110000111100011111000
$ hex2bin hexfile.hex | bin201 | 012bin | bin2hex 000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F
Spaces between bytes with -s. Little endian by default. $ ./bin201 -s hexfile.bin 00000000 10000000 01000000 11000000 00100000 10100000 01100000 11100000 00010000 10010000 01010000 11010000 00110000 10110000 01110000 11110000 00001000 10001000 01001000 11001000 00101000 10101000 01101000 11101000 00011000 10011000 01011000 11011000 00111000 10111000 01111000 11111000
Big endian output of bits with -B:
$ ./bin201 -B -s hexfile.bin 00000000 00000001 00000010 00000011 00000100 00000101 00000110 00000111 00001000 00001001 00001010 00001011 00001100 00001101 00001110 00001111 00010000 00010001 00010010 00010011 00010100 00010101 00010110 00010111 00011000 00011001 00011010 00011011 00011100 00011101 00011110 00011111
Related Skills
node-connect
349.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
