Encode/Hash a String and Decode It

Mindwatering Incorporated

Author: Tripp W Black

Created: 05/29 at 05:17 PM

 

Category:
Linux
Other

Task:
Encode a string to base64, and then decode the string from base64 to a normal string again.


Steps:
1. Encode a string:
$ echo -n 'my1ststring4conversion2base64' | base64
<view output>

Perform again to a file:
$ echo -n 'my1ststring4conversion2base64' | base64 > encoded-string.txt
$ cat encoded-string.txt
<view encoded string result>


2. Decode the base64 encoded string:
$ cat encoded-string.txt | base64 --decode > decoded-string.txt
$ cat decoded-string.txt
<should be same as original string: my1ststring4conversion2base64>




previous page

×