Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

add util for md5

Chris Lu00b993a23403
diff --git a/weed/util/bytes.go b/weed/util/bytes.go
index d9e462693e..d72d199f8f 100644
--- a/weed/util/bytes.go
+++ b/weed/util/bytes.go
@@ -2,6 +2,7 @@ package util
import (
"crypto/md5"
+ "fmt"
"io"
)
@@ -91,3 +92,9 @@ func HashToInt32(data []byte) (v int32) {
return
}
+
+func Md5(data []byte) string {
+ hash := md5.New()
+ hash.Write(data)
+ return fmt.Sprintf("%x", hash.Sum(nil))
+}