mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update buildkit to master@31c870e82a48
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
30
vendor/github.com/in-toto/in-toto-golang/in_toto/hashlib.go
generated
vendored
Normal file
30
vendor/github.com/in-toto/in-toto-golang/in_toto/hashlib.go
generated
vendored
Normal 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)
|
||||
}
|
Reference in New Issue
Block a user