From d654270130a923ddb1171e5b7b565355dd4cd4a3 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Wed, 21 Dec 2022 12:46:15 -0400 Subject: [PATCH] fix: endianness of nonce function --- noise.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/noise.go b/noise.go index f113898..36ce6f7 100644 --- a/noise.go +++ b/noise.go @@ -67,8 +67,10 @@ func (c *CipherState) hasKey() bool { } func (cs *CipherState) nonce() []byte { - var nonceBytes [12]byte // RFC7539 specifies 12 bytes for nonce. - binary.BigEndian.PutUint64(nonceBytes[4:], cs.n) + // RFC7539 specifies 12 bytes for nonce. + // TODO: extract this to function setup when creating handshake pattern + var nonceBytes [12]byte + binary.LittleEndian.PutUint64(nonceBytes[4:], cs.n) return nonceBytes[:] }