// If the object implements common.Hasher Interface, the HashValue() method is directly used
// to generate the hash value. Otherwise, hash will be performed after serializing the object
If the object implements common.Hasher Interface, the HashValue() method is directly used
to generate the hash value. Otherwise, hash will be performed after serializing the object
// If the object implements common . Hasher Interface the HashValue () method is directly used // to generate the hash value . Otherwise hash will be performed after serializing the object
func HashObject(o interface{}) ([]byte, error) {
	if o == nil {
		return NilHashSlice, nil
	}
	v := reflect.ValueOf(o)
	if !v.IsValid() {
		return NilHashSlice, nil
	}
	switch val := o.(type) {
	case Hasher:
		return val.HashValue()
	default:
		hasher := RealCipher.Hasher()
		if err := rtl.Encode(val, hasher); err != nil {
			return nil, err
		}
		return hasher.Sum(nil), nil
	}
}
func HashObject ( o interface { } ) ( [ ] byte , error ) { if o == nil { return NilHashSlice , nil } v := reflect . ValueOf ( o ) if ! v . IsValid ( ) { return NilHashSlice , nil } switch val := o . ( type ) { case Hasher : return val . HashValue ( ) default : hasher := RealCipher . Hasher ( ) if err := rtl . Encode ( val , hasher ) ; err != nil { return nil , err } return hasher . Sum ( nil ) , nil } }
If the object implements common.Hasher Interface, the HashValue() method is directly used
to generate the hash value.
If the object implements common . Hasher Interface the HashValue () method is directly used to generate the hash value .