mirror of
https://github.com/minio/minio.git
synced 2026-11-18 23:00:19 +00:00
Implement md5c function, slower than Golang's implementation
keeping it in repo to make further improvements and also rename
minio-hash ---> crypto
This commit is contained in:
1 parent
958890276d
commit
13650e088c
11 files changed
+449
-17
No files matched your search
@@ -8,10 +8,15 @@ import (
|
||||
func Sum(reader io.Reader) ([]byte, error) {
|
||||
hash := md5.New()
|
||||
var err error
|
||||
var length int
|
||||
for err == nil {
|
||||
length := 0
|
||||
byteBuffer := make([]byte, 1024*1024)
|
||||
length, err = reader.Read(byteBuffer)
|
||||
// While hash.Write() wouldn't mind a Nil byteBuffer
|
||||
// It is necessary for us to verify this and break
|
||||
if length == 0 {
|
||||
break
|
||||
}
|
||||
byteBuffer = byteBuffer[0:length]
|
||||
hash.Write(byteBuffer)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user