MCPcopy Create free account
hub / github.com/LagrangeDev/LagrangeGo / ComputeMd5AndLength

Function ComputeMd5AndLength

utils/crypto/hash.go:33–41  ·  view source on GitHub ↗

form MiraiGo

(r io.ReadSeeker)

Source from the content-addressed store, hash-verified

31// form MiraiGo
32
33func ComputeMd5AndLength(r io.ReadSeeker) ([]byte, uint32) {
34 _, _ = r.Seek(0, io.SeekStart)
35 defer func(r io.ReadSeeker, offset int64, whence int) {
36 _, _ = r.Seek(offset, whence)
37 }(r, 0, io.SeekStart)
38 h := md5.New()
39 length, _ := io.Copy(h, r)
40 return h.Sum(nil), uint32(length)
41}
42
43func ComputeMd5AndLengthWithLimit(r io.ReadSeeker, limit int64) ([]byte, uint32) {
44 _, _ = r.Seek(0, io.SeekStart)

Callers 4

UploadGroupAlbumPhotoMethod · 0.92
UploadGroupAlbumVideoMethod · 0.92
SetAvatarMethod · 0.92
SetGroupAvatarMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected