Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

base64 encode string from a terminal? [closed]

OS X 10.8.3 C++

We have base64 encode and decode functions in our code.

However, I want to base64 encode a string from my terminal and use it in my code so our functions can decode it when it needs to be used.

How does one base64 encode a string from a terminal?

like image 566
Jasmine Avatar asked Aug 23 '26 18:08

Jasmine


2 Answers

Using the base64 command, sensibly enough:

# echo -n Hello | base64
SGVsbG8K
# echo SGVsbG8K | base64 -D
Hello

From here:

base64 command is available by default on my OS X 10.9.4.

Encoding: base64 <<< string.
Decoding: base64 -D <<< string.

like image 22
RtmY Avatar answered Aug 26 '26 07:08

RtmY



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!