How to encode text or file in base64

How To Encode Text Or File In Base64


What Is Base64

In computer scienceBase64 is a group of binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The term Base64 originates from a specific MIME content transfer encoding. Each Base64 digit represents exactly 6 bits of data. Three 8-bit bytes (i.e., a total of 24 bits) can, therefore, be represented by four 6-bit Base64 digits.
actually, there is a lot of difference between encoding and encryption, in case you don’t know.

Tutorial

Fire up your terminal and type:
man base64
This command will show you the help menu of the base64 tool.
To encode a text in terminal:
echo "<your-text-here>" | base64
For example, We are encoding “shubhamyadav”.
echo "shubhamyadav" | base64
output: dGVjaG5pY2FsbmF2aWdhdG9yCg==

Now, If you want to decode it, type this command:
echo "dGVjaG5pY2FsbmF2aWdhdG9yCg==" | base64 --decode

With the help of this tool you can even encode a whole text file into base64:
base64 "filename.txt" > output.txt
And, If you want to decode it:
base64 --decode <output.txt>


Thanks For Visiting.


Thank's and Regards,
Shubham Yadav
( Cyber Security Expert )

No comments:

Post a Comment

Search Here

Advertisement