Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
| 1 |
package aead |
| 2 |
|
| 3 |
import ( |
| 4 |
"crypto/hmac" |
| 5 |
"crypto/sha256" |
| 6 |
"hash" |
| 7 |
) |
| 8 |
|
| 9 |
func KDF(key []byte, path ...string) []byte { |
| 10 |
hmacf := hmac.New(sha256.New, []byte(KDFSaltConstVMessAEADKDF)) |
| 11 |
|
| 12 |
for _, v := range path { |
| 13 |
hmacf = hmac.New(func() hash.Hash { |
| 14 |
return hmacf |
| 15 |
}, []byte(v)) |
| 16 |
} |
| 17 |
hmacf.Write(key) |
| 18 |
return hmacf.Sum(nil) |
| 19 |
} |
| 20 |
|
| 21 |
func KDF16(key []byte, path ...string) []byte { |
| 22 |
r := KDF(key, path...) |
| 23 |
return r[:16] |
| 24 |
} |