websocket-based lrcproto server
at main 16 lines 333 B view raw
1package lrcd 2 3import ( 4 "crypto/sha256" 5 "encoding/binary" 6) 7 8func GenerateNonce(messageID uint32, channelURI string, secret string) []byte { 9 h := sha256.New() 10 idBytes := make([]byte, 4) 11 binary.LittleEndian.PutUint32(idBytes, messageID) 12 h.Write(idBytes) 13 h.Write([]byte(channelURI)) 14 h.Write([]byte(secret)) 15 return h.Sum(nil) 16}