github.com/qjfoidnh/BaiduPCS-Go@v0.0.0-20231011165705-caa18a3765f3/baidupcs/netdisksign/share_sign.go (about)

     1  package netdisksign
     2  
     3  import (
     4  	"crypto/md5"
     5  	"encoding/hex"
     6  	"github.com/qjfoidnh/BaiduPCS-Go/pcsutil/cachepool"
     7  	"github.com/qjfoidnh/BaiduPCS-Go/pcsutil/converter"
     8  	"strconv"
     9  )
    10  
    11  func ShareSURLInfoSign(shareID int64) []byte {
    12  	s := strconv.FormatInt(shareID, 10)
    13  	m := md5.New()
    14  	m.Write(converter.ToBytes(s))
    15  	m.Write([]byte("_sharesurlinfo!@#"))
    16  	res := m.Sum(nil)
    17  	resHex := cachepool.RawMallocByteSlice(32)
    18  	hex.Encode(resHex, res)
    19  	return resHex
    20  }