Update Internals.md

This commit is contained in:
Evan Su 2021-06-05 20:33:33 -04:00 committed by GitHub
parent ed1eb74906
commit 8fef4dd7dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -12,7 +12,7 @@ The first is provided by <a href="https://monocypher.org">Monocypher</a>, a libr
### Here's how encryption works:
- A master key is generated by hashing the user's password using Argon2id. If fast mode is enabled, Picocrypt uses Argon2id with 4 passes, 128 MiB of memory, and 4 threads. If fast mode is not enabled, Picocrypt uses 8 passes, 1 GiB of memory, and 8 threads.
- A SHA3-256 hash of the master key is generated and stored. This is used to let the user know if their password is correct. Note that this is a hash of the <i>derived</i> key, so it cannot be bruteforced.
- A SHA3-512 hash of the master key is generated and stored. This is used to let the user know if their password is correct. Note that this is a hash of the <i>derived</i> key, so it cannot be bruteforced.
- Encryption occurs in 1 MiB chunks (1048576 bytes). For each chunk, a 24-byte nonce is generated using Go's `crypto/rand`. The nonce is then appended to a list. The chunk is encrypted with the master key and the unique nonce. The Poly1305 tag is obtained after encryption and is appended to the chunk before the chunk is written to file.
- When all the chunks have been encrypted, the list of nonces is encrypted using the master key and written to the file. This is done to prevent the nonces from being reordered.