ComputeHash returns a hash value calculated from the provided object. The hash will be safe encoded to avoid bad words.
(object interface{})
| 47 | // ComputeHash returns a hash value calculated from the provided object. |
| 48 | // The hash will be safe encoded to avoid bad words. |
| 49 | func ComputeHash(object interface{}) (string, error) { |
| 50 | hasher := fnv.New32a() |
| 51 | if err := DeepHashObject(hasher, object); err != nil { |
| 52 | return "", err |
| 53 | } |
| 54 | |
| 55 | return rand.SafeEncodeString(fmt.Sprint(hasher.Sum32())), nil |
| 56 | } |
| 57 | |
| 58 | // ComputeVersionedHash follows the same rules of ComputeHash with the exception that accepts also a epoc value. |
| 59 | // The epoc value is used to generate a new hash from a same object. |
no test coverage detected