Files
crawlab/core/utils/hash.go
2024-08-26 18:33:46 +08:00

13 lines
216 B
Go

package utils
import "encoding/json"
func GetObjectHash(obj any) string {
data, _ := json.Marshal(obj)
if data == nil {
// random hash
return EncryptMd5(NewUUIDString())
}
return EncryptMd5(string(data))
}