uquic/crypto/nonce.go
2017-08-30 00:19:44 +07:00

14 lines
297 B
Go

package crypto
import (
"encoding/binary"
"github.com/lucas-clemente/quic-go/internal/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
}