IsValid tell if the hash is valid
()
| 38 | |
| 39 | // IsValid tell if the hash is valid |
| 40 | func (h *Hash) IsValid() bool { |
| 41 | // Support for both sha1 and sha256 git hashes |
| 42 | if len(*h) != idLengthSHA1 && len(*h) != idLengthSHA256 { |
| 43 | return false |
| 44 | } |
| 45 | for _, r := range *h { |
| 46 | if (r < 'a' || r > 'f') && (r < '0' || r > '9') { |
| 47 | return false |
| 48 | } |
| 49 | } |
| 50 | return true |
| 51 | } |
no outgoing calls
no test coverage detected