Convert Ascii to Binary



Published: 2018-09-20 22:12:39 +0000
Categories: BASH,

Language

BASH

Description

Simple one liner to dump an Ascii string out in binary

Snippet

echo $MESSAGE | perl -lpe '$_=unpack"B*",$_'

# To convert back
echo $BINARY | perl -lpe '$_=pack"B*",$_'

Usage Example

$ echo Hello World | perl -lpe '$_=unpack"B*",$_'
0100100001100101011011000110110001101111001000000101011101101111011100100110110001100100

$ echo 0100100001100101011011000110110001101111001000000101011101101111011100100110110001100100 | perl -lpe '$_=pack"B*",$_'
Hello World

Keywords

Ascii, Binary, Convert,

Latest Posts


Copyright © 2019 Ben Tasker | Sitemap | Privacy Policy
Available at snippets.bentasker.co.uk and snippets.6zdgh5a5e6zpchdz.onion