harness-drone/vendor/github.com/lucas-clemente/quic-go/crypto/nonce.go
2017-07-24 19:15:25 -04:00

14 lines
288 B
Go

package crypto
import (
"encoding/binary"
"github.com/lucas-clemente/quic-go/protocol"
)
func makeNonce(iv []byte, packetNumber protocol.PacketNumber) []byte {
res := make([]byte, 12)
copy(res[0:4], iv)
binary.LittleEndian.PutUint64(res[4:12], uint64(packetNumber))
return res
}