working commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package operator
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const sha256prefix = "sha256:"
|
||||
|
||||
func stringLikeSHA256Digest(some string) bool {
|
||||
if strings.HasPrefix(some, sha256prefix) {
|
||||
some = strings.TrimPrefix(some, sha256prefix)
|
||||
}
|
||||
_, err := hex.DecodeString(some)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if len(some) == 64 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user