vendor: update buildkit to master@31c870e82a48

Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
Justin Chadwell
2023-05-15 18:32:31 +01:00
parent 167cd16acb
commit e61a8cf637
269 changed files with 25798 additions and 3371 deletions

View File

@ -0,0 +1,30 @@
package in_toto
import (
"crypto/sha256"
"crypto/sha512"
"hash"
)
/*
getHashMapping returns a mapping from hash algorithm to supported hash
interface.
*/
func getHashMapping() map[string]func() hash.Hash {
return map[string]func() hash.Hash{
"sha256": sha256.New,
"sha512": sha512.New,
"sha384": sha512.New384,
}
}
/*
hashToHex calculates the hash over data based on hash algorithm h.
*/
func hashToHex(h hash.Hash, data []byte) []byte {
h.Write(data)
// We need to use h.Sum(nil) here, because otherwise hash.Sum() appends
// the hash to the passed data. So instead of having only the hash
// we would get: "dataHASH"
return h.Sum(nil)
}