From 950cd0dddaed5d4536ec5519361a573451b42a30 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bossuat Date: Wed, 18 May 2022 17:03:44 +0200 Subject: [PATCH] [ring]: fixed typo in marshal 32 bits --- ring/ring_poly.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ring/ring_poly.go b/ring/ring_poly.go index 3587ccaa..ce48fdec 100644 --- a/ring/ring_poly.go +++ b/ring/ring_poly.go @@ -290,6 +290,7 @@ func (pol *Poly) WriteTo32(data []byte) (int, error) { //The data is not big enough to write all the information return 0, errors.New("data array is too small to write ring.Poly") } + binary.BigEndian.PutUint32(data, uint32(N)) data[4] = uint8(Level) if pol.IsNTT { @@ -319,7 +320,7 @@ func WriteCoeffsTo32(pointer int, coeffs []uint64, data []byte) (int, error) { // Assumes that each coefficient will be encoded on 4 bytes. // It can take into account meta data if necessary. func GetPolyDataLen32(N, Level int, WithMetadata bool) (cnt int) { - cnt += N * (Level + 1) << 4 + cnt += N * (Level + 1) << 2 if WithMetadata { cnt += 7