mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
* fix: repeated modification session notification * fix: repeated modification session notification * fix: jpush return a nil pointer panic * fix: push redis pkg * fix: OANotification * feat: add rpc GetConversationNeedOfflinePushUserIDs * update pkg * cicd: robot automated Change * offlinePushMsg * conversation * conversation * cicd: robot automated Change * conversation * cicd: robot automated Change * conversation * url 2 im s3 * url 2 im s3 * cicd: robot automated Change * url 2 im s3 --------- Co-authored-by: withchao <withchao@users.noreply.github.com>
30 lines
423 B
Go
30 lines
423 B
Go
package pkg
|
|
|
|
import (
|
|
"crypto/md5"
|
|
"encoding/hex"
|
|
"hash"
|
|
"io"
|
|
)
|
|
|
|
func NewMd5Reader(r io.Reader) *Md5Reader {
|
|
return &Md5Reader{h: md5.New(), r: r}
|
|
}
|
|
|
|
type Md5Reader struct {
|
|
h hash.Hash
|
|
r io.Reader
|
|
}
|
|
|
|
func (r *Md5Reader) Read(p []byte) (n int, err error) {
|
|
n, err = r.r.Read(p)
|
|
if err == nil && n > 0 {
|
|
r.h.Write(p[:n])
|
|
}
|
|
return
|
|
}
|
|
|
|
func (r *Md5Reader) Md5() string {
|
|
return hex.EncodeToString(r.h.Sum(nil))
|
|
}
|