Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Time is the number of iterations Time uint32 = 1 // Memory is the memory usage in KiB Memory uint32 = 1024 * 64 // Threads is the number of threads to calculate the hash Threads uint8 = 2 // SaltLength is the length of the salt SaltLength uint32 = 16 // KeyLength is the length of the hashed key KeyLength uint32 = 32 )
argon2id params
Functions ¶
func Generate ¶
Generate generates a new hashed password
Example ¶
hash, err := Generate([]byte("password"), []byte("salt ")) if err != nil { panic(err) } fmt.Printf("Hash: %x\n", hash)
Output: Hash: 73616c7420202020202020202020202056a3984c5b69cbc7819ff6097dc4fb65f154d5509d0c021f6bc8e7c135253eb3
func Verify ¶
Verify verifies a password against a hash
Example ¶
hash, _ := hex.DecodeString("73616c7420202020202020202020202056a3984c5b69cbc7819ff6097dc4fb65f154d5509d0c021f6bc8e7c135253eb3") ok, err := Verify([]byte("password"), hash) if err != nil { panic(err) } fmt.Printf("Password verification: %t\n", ok)
Output: Password verification: true
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.