mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-22 03:57:23 +08:00
use MD5 for ETag to be consistent with Amazon S3
This commit is contained in:
@@ -2,8 +2,9 @@ package storage
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/klauspost/crc32"
|
||||
"crypto/md5"
|
||||
|
||||
"github.com/klauspost/crc32"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
@@ -28,3 +29,13 @@ func (n *Needle) Etag() string {
|
||||
util.Uint32toBytes(bits, uint32(n.Checksum))
|
||||
return fmt.Sprintf("%x", bits)
|
||||
}
|
||||
|
||||
func (n *Needle) MD5() string {
|
||||
|
||||
hash := md5.New()
|
||||
|
||||
hash.Write(n.Data)
|
||||
|
||||
return fmt.Sprintf("%x", hash.Sum(nil))
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user