1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 08:19:40 +02:00

feat(libcrypto): move into the Portainer repository EE-5476 (#10230)

This commit is contained in:
andres-portainer 2023-09-01 17:27:19 -03:00 committed by GitHub
parent 9a234204fa
commit 090fa4aeb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 194 additions and 7 deletions

19
pkg/libcrypto/hash.go Normal file
View file

@ -0,0 +1,19 @@
package libcrypto
import (
"crypto/md5"
"encoding/hex"
)
// HashFromBytes returns the hash of the specified data
func HashFromBytes(data []byte) []byte {
digest := md5.New()
digest.Write(data)
return digest.Sum(nil)
}
// Hash32Bit returns a hexadecimal encoded hash
func Hash32Bit(data []byte) []byte {
hash := HashFromBytes(data)
return []byte(hex.EncodeToString(hash))
}