harness-drone/vendor/github.com/lucas-clemente/quic-go/crypto/nonce.go

15 lines
288 B
Go
Raw Normal View History

2017-07-24 23:15:25 +00:00
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
}