Skip to content

Commit 87b993f

Browse files
committed
Added README.md
1 parent 6b535f0 commit 87b993f

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

README.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## ChaChaCrypt
2+
3+
A small command line utility to encrypt and decrypt files with XChaCha20-Poly1305 written in Go.
4+
5+
### Usage
6+
```text
7+
ccc_encrypt.exe "file.txt"
8+
ccc_decrypt.exe "file.txt.ccc"
9+
10+
ccc_encrypt.exe -m 1024 "file.txt" "file2.txt" <...>
11+
ccc_encrypt.exe -m 128 -t 8 -i 1 "file.txt"
12+
```
13+
14+
### Command Line Arguments
15+
```text
16+
-m <1-65535> | Argon2id Memory Usage in MiB | Default: 64MiB
17+
-t <1-255> | Argon2id Thread Count | Default: 4
18+
-i <1-255> | Argon2id Iteration Count | Default: 4
19+
```
20+
21+
### Information
22+
Files are encrypted in chunks, using the memory size specified for Argon2id to define the chunk size.
23+
24+
For example, if using the default Argon2id memory of 64MiB, each 64 MiB chunk of the file is encrypted with its own
25+
nonce.
26+
27+
This is done to keep memory usage of the program down, as for AEAD all bytes being encrypted need to be in memory. It's
28+
a safe assumption then that if the user uses 4GiB for key derivation, they have the RAM required to read and encrypt
29+
4GiB chunks of data at a time.
30+
31+
### CCC File Format
32+
Each CCC file contains a 24 byte header.
33+
34+
| Magic Number | Argon2id Memory Usage (in MiB) | Argon2id Thread Count | Argon2id Iteration Count | Argon2id Salt |
35+
|--------------|--------------------------------|-----------------------|--------------------------|---------------|
36+
| 4 Bytes | 2 Bytes | 1 Byte | 1 Byte | 16 Bytes |
37+
38+
Each chunk has a 1 byte status flag, to indicate if it is the last chunk of the file.
39+
40+
As the chunk size is derived from
41+
Argon2id memory usage, the chunk's size isn't stored. If the chunk is the last chunk, the rest of the file is read.
42+
43+
|Status Byte|File Data|
44+
|---|---|
45+
|1 Byte|Variable Bytes|

0 commit comments

Comments
 (0)