Skip to content

Encode Base64

Naser edited this page Mar 27, 2023 · 6 revisions

The base64 sub-command of encode, allows users to encode and decode Base64 text.

Usage

nhash encode base64 <text> [options]

Arguments

  • <text>: Text to encode or decode in Base64 format.

Options

  • -d, --decode: Decodes the Base64 text instead of encoding it.
  • -o, --output <output>: File name to write the output to.
  • -?, -h, --help: Show help and usage information.

Examples

  1. Encoding a string in Base64:
nhash encode base64 "Hello, World"

Output:

SGVsbG8sIFdvcmxk
  1. Decoding a Base64 string:
nhash encode base64 SGVsbG8sIFdvcmxkIQ== -d

Output:

Hello, World!
  1. Encoding a string and writing the output to a file:
nhash encode base64 "Hello, World" --output encoded.txt

Output:

The encoded text is written to the encoded.txt file.

  1. Decoding a Base64 string and writing the output to a file:
nhash encode base64 SGVsbG8sIFdvcmxkIQ== -d --output decoded.txt

Output:

The decoded text is written to the decoded.txt file.

Clone this wiki locally