Available returns true if the digest type is available for use. If this returns false, Digester and Hash will return nil.
()
| 65 | // Available returns true if the digest type is available for use. If this |
| 66 | // returns false, Digester and Hash will return nil. |
| 67 | func (a Algorithm) Available() bool { |
| 68 | h, ok := algorithms[a] |
| 69 | if !ok { |
| 70 | return false |
| 71 | } |
| 72 | |
| 73 | // check availability of the hash, as well |
| 74 | return h.Available() |
| 75 | } |
| 76 | |
| 77 | func (a Algorithm) String() string { |
| 78 | return string(a) |