Initial encryption/decryption via ChaCha20-Poly1305

This commit is contained in:
2025-05-03 17:13:09 -04:00
parent 9b106e8147
commit 84bd8c3a42
5 changed files with 117 additions and 2 deletions
+19
View File
@@ -0,0 +1,19 @@
package wrappers
import (
"golang.org/x/crypto/argon2"
"golang.org/x/crypto/chacha20poly1305"
)
// parameters for Argon2
const (
argonTime = 1
argonMemory = 64 * 1024
argonThreads = 4
argonKeyLen = chacha20poly1305.KeySize
)
// DeriveKey derives an encryption key from a passphrase using Argon2.
func deriveKey(passphrase []byte, salt []byte) []byte {
return argon2.IDKey(passphrase, salt, argonTime, argonMemory, argonThreads, argonKeyLen)
}