Documentation ¶
Overview ¶
Package argon2 implements the key derivation function Argon2. Argon2 was selected as the winner of the Password Hashing Competition and can be used to derive cryptographic keys from passwords. Argon2 is specfifed at https://github.com/P-H-C/phc-winner-argon2/blob/master/argon2-specs.pdf
Index ¶
Constants ¶
const Version = 0x13
The Argon2 version implemented by this package.
Variables ¶
This section is empty.
Functions ¶
func Key ¶
Key derives a key from the password, salt, and cost parameters using Argon2i returning a byte slice of length keyLen that can be used as cryptographic key. The CPU cost and parallism degree must be greater than zero.
For example, you can get a derived key for e.g. AES-256 (which needs a 32-byte key) by doing: `key := argon2.Key([]byte("some password"), salt, 4, 32*1024, 4, 32)`
The recommended parameters for interactive logins as of 2017 are time=4, memory=32*1024. The number of threads can be adjusted to the numbers of available CPUs. The time parameter specifies the number of passes over the memory and the memory parameter specifies the size of the memory in KiB. For example memory=32*1024 sets the memory cost to ~32 MB. The cost parameters should be increased as memory latency and CPU parallelism increases. Remember to get a good random salt.
Types ¶
This section is empty.