Beispiel #1
0
func BenchmarkMMagical(b *testing.B) {
	b.ReportAllocs()

	for n := 0; n < b.N; n++ {
		magic.Key(password, salt, 3, 4, 4096, 32)
	}
}
Beispiel #2
0
// Apply the password: create Ed25519 keypair based on it, save public
// key in verifier.
func (v *Verifier) PasswordApply(password string) *[ed25519.PrivateKeySize]byte {
	r, err := argon2.Key([]byte(password), v.Id[:], v.T, v.P, int64(v.M), 32)
	if err != nil {
		log.Fatalln("Unable to apply Argon2d", err)
	}
	defer sliceZero(r)
	src := bytes.NewBuffer(r)
	pub, prv, err := ed25519.GenerateKey(src)
	if err != nil {
		log.Fatalln("Unable to generate Ed25519 keypair", err)
	}
	v.Pub = pub
	return prv
}