EncodeToString the encoded hash value of the content provided in b.
(b []byte)
| 278 | |
| 279 | // EncodeToString the encoded hash value of the content provided in b. |
| 280 | func (c ChecksumType) EncodeToString(b []byte) string { |
| 281 | if !c.IsSet() { |
| 282 | return "" |
| 283 | } |
| 284 | h := c.Hasher() |
| 285 | h.Write(b) |
| 286 | return base64.StdEncoding.EncodeToString(h.Sum(nil)) |
| 287 | } |
| 288 | |
| 289 | // String returns the type as a string. |
| 290 | // Empty string for unset and "<invalid>" if not valid. |