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

Function ComputeSha1AndLength

utils/crypto/hash.go:54–62  ·  view source on GitHub ↗
(r io.ReadSeeker)

Source from the content-addressed store, hash-verified

52}
53
54func ComputeSha1AndLength(r io.ReadSeeker) ([]byte, uint32) {
55 _, _ = r.Seek(0, io.SeekStart)
56 defer func(r io.ReadSeeker, offset int64, whence int) {
57 _, _ = r.Seek(offset, whence)
58 }(r, 0, io.SeekStart)
59 h := sha1.New()
60 length, _ := io.Copy(h, r)
61 return h.Sum(nil), uint32(length)
62}
63
64func ComputeMd5AndSha1AndLength(r io.ReadSeeker) ([]byte, []byte, uint64) {
65 defer func(r io.ReadSeeker, offset int64, whence int) {

Callers 1

UploadGroupAlbumVideoMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected