reprogl
1package security2
3import (4"crypto/sha512"5"fmt"6)
7
8const iterations = 36009
10func EncodePassword(password string, salt string) string {11salted := []byte(password + "{" + salt + "}")12h := sha512.New384()13
14h.Write(salted)15digest := h.Sum(nil)16
17for i := 1; i < iterations; i++ {18h.Reset()19h.Write(digest)20h.Write(salted)21digest = h.Sum(nil)22}23
24return fmt.Sprintf("%x", digest)25}
26