https://github.com/waldner/bachacha
ChaCha20 in bash
https://github.com/waldner/bachacha
bash chacha-cipher chacha20
Last synced: 7 months ago
JSON representation
ChaCha20 in bash
- Host: GitHub
- URL: https://github.com/waldner/bachacha
- Owner: waldner
- Created: 2021-05-28T10:20:12.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-09-01T09:59:47.000Z (about 4 years ago)
- Last Synced: 2025-02-06T07:21:17.950Z (8 months ago)
- Topics: bash, chacha-cipher, chacha20
- Language: Shell
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# baCHACHA
Hot, low speed CHACHA20 encryption in Bash### What's this?
This is an implementation of [**ChaCha20**](https://cr.yp.to/chacha.html) ([also](https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant)) encryption without any external programs. No dependencies, other than a recent version of bash.
**WARNING: THIS IS EXTREMELY SLOW AND INEFFICIENT. DO NOT USE IT FOR ANY SERIOUS PURPOSE, AND DO NOT USE IT ON LARGE AMOUNTS OF DATA (EVEN _A FEW TENS_ OF KB ARE ALREADY A LOT FOR THIS BEAST). YOU HAVE BEEN WARNED.**
### Why is it "low speed"?
See the following comparison with [openssl](https://www.openssl.org/) to encrypt a file:
$ ls -al /bin/w
-rwxr-xr-x 1 root root 22576 Feb 13 20:05 /bin/w
$ time openssl chacha20 -K 9900000000000000000000000000000000000000000000000000000000000001 -iv 00000000000000002607000a00040001 < /bin/w > /dev/nullreal 0m0.005s
user 0m0.005s
sys 0m0.000s
$ time ./chacha.sh -K 9900000000000000000000000000000000000000000000000000000000000001 -I 2607000a00040001 < /bin/w > /dev/nullreal 0m7.388s
user 0m7.099s
sys 0m0.140s### How do I install it?
Just run the `chacha.sh` script with the necessary arguments (see **`chacha.sh -h`** for help).
### How do I know that it produces correct results?
There are two test scripts in the `tests/` directory, whose job is to compare results from `chacha.sh` and `openssl chacha20` (see comments in the scripts). All tests should pass.