(secret string)
| 108 | } |
| 109 | } |
| 110 | func salt(secret string) (string, error) { |
| 111 | |
| 112 | buf := make([]byte, saltSize, saltSize+md5.Size) |
| 113 | _, err := io.ReadFull(rand.Reader, buf) |
| 114 | if err != nil { |
| 115 | return "", err |
| 116 | } |
| 117 | |
| 118 | hash := md5.New() |
| 119 | hash.Write(buf) |
| 120 | hash.Write([]byte(secret)) |
| 121 | return hex.EncodeToString(hash.Sum(buf)), nil |
| 122 | } |
| 123 | |
| 124 | func saltSecret() (string, error) { |
| 125 | rb := make([]byte, randInt(10, 100)) |