56 lines
No EOL
977 B
Markdown
56 lines
No EOL
977 B
Markdown
# b64
|
|
|
|
Is a tool I created to
|
|
* Quickly encode and decode base64
|
|
* Learn a bit of Zig
|
|
|
|
|
|
## Usage
|
|
```
|
|
Usage: b64 [-e] [-d] <string>
|
|
|
|
-h, --help
|
|
Display this help and exit.
|
|
|
|
-d, --decode
|
|
Decode base64 to string.
|
|
|
|
-e, --encode
|
|
Encode string to base64.
|
|
|
|
-v, --version
|
|
Display version.
|
|
|
|
<str>
|
|
String to encode or decode.
|
|
```
|
|
### Encoding
|
|
|
|
```shell
|
|
$ b64 -e "encode this string to base64"
|
|
ZW5jb2RlIHRoaXMgc3RyaW5nIHRvIGJhc2U2NA==
|
|
|
|
# From stdin
|
|
$ echo -n "encode this string to base64" | b64 -e
|
|
ZW5jb2RlIHRoaXMgc3RyaW5nIHRvIGJhc2U2NA==
|
|
$
|
|
```
|
|
|
|
### Decoding
|
|
```shell
|
|
$ b64 -d ZW5jb2RlIHRoaXMgc3RyaW5nIHRvIGJhc2U2NA==
|
|
encode this string to base64
|
|
|
|
# From stdin
|
|
$ echo -n "ZW5jb2RlIHRoaXMgc3RyaW5nIHRvIGJhc2U2NA==" | b64 -d
|
|
encode this string to base64
|
|
$
|
|
```
|
|
|
|
## Build
|
|
|
|
```shell
|
|
$ git clone https://git.kcbark.net/zig/b64.git && cd b64
|
|
$ zig build -Doptimize=ReleaseFast
|
|
$ cp zig-out/bin/b64 ~/.local/bin
|
|
``` |