Use all available threads for argon2

This commit is contained in:
2025-05-08 14:17:52 +00:00
parent 5975c71b4f
commit eda92fccdd
+4 -1
View File
@@ -1,6 +1,8 @@
package wrappers
import (
"runtime"
"golang.org/x/crypto/argon2"
"golang.org/x/crypto/chacha20poly1305"
)
@@ -9,13 +11,14 @@ const (
// parameters for Argon2
argonTime = 1
argonMemory = 64 * 1024
argonThreads = 4
argonKeyLen = chacha20poly1305.KeySize
// general constants
saltSize = 16
)
var argonThreads = uint8(runtime.NumCPU())
// 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)