diff --git a/constantine.nimble b/constantine.nimble index 84b5964..06bb98b 100644 --- a/constantine.nimble +++ b/constantine.nimble @@ -17,7 +17,7 @@ proc test(fakeCurves: string, path: string, lang = "c") = ### tasks task test, "Run all tests": test "", "tests/test_primitives.nim" - test "", "tests/test_io.nim" + test "", "tests/test_io_bigints.nim" test "", "tests/test_bigints.nim" test "", "tests/test_bigints_multimod.nim" test "", "tests/test_bigints_vs_gmp.nim" diff --git a/constantine/io/io_bigints.nim b/constantine/io/io_bigints.nim index bf0be99..a1f48d5 100644 --- a/constantine/io/io_bigints.nim +++ b/constantine/io/io_bigints.nim @@ -273,7 +273,7 @@ func hexToPaddedByteArray(hexStr: string, output: var openArray[byte], order: st let maxStrSize = output.len * 2 let size = hexStr.len - skip - nonBlanksCount - doAssert size <= maxStrSize + doAssert size <= maxStrSize, "size: " & $size & " (without blanks or prefix), maxSize: " & $maxStrSize if size < maxStrSize: # include extra byte if odd length @@ -330,6 +330,7 @@ func fromHex*(T: type BigInt, s: string): T = # 1. Convert to canonical uint const canonLen = (T.bits + 8 - 1) div 8 var bytes: array[canonLen, byte] + debugEcho "canonLen: ", canonLen hexToPaddedByteArray(s, bytes, littleEndian) # 2. Convert canonical uint to Big Int diff --git a/tests/test_io.nim b/tests/test_io_bigints.nim similarity index 100% rename from tests/test_io.nim rename to tests/test_io_bigints.nim