mirror of
https://github.com/vacp2p/mix.git
synced 2026-01-09 22:18:09 -05:00
Add FieldElementSize
This commit is contained in:
@@ -6,13 +6,14 @@ license = "MIT"
|
||||
|
||||
# Dependencies
|
||||
requires "nim >= 1.6.0"
|
||||
requires "nimcrypto"
|
||||
requires "nimcrypto >= 0.6.0"
|
||||
requires "libp2p >= 1.4.0"
|
||||
requires "protobuf_serialization >= 0.3.0"
|
||||
requires "serialization >= 0.2.2"
|
||||
|
||||
# Set the source directory
|
||||
srcDir = "src"
|
||||
|
||||
# Tasks
|
||||
task test, "Run the test suite":
|
||||
exec "nim c -r --path:src tests/test_crypto.nim"
|
||||
exec "nim c -r --path:src tests/test_curve25519.nim"
|
||||
exec "nim c -r --path:src tests/test_curve25519.nim"
|
||||
@@ -15,8 +15,8 @@ suite "Curve25519 Tests":
|
||||
(privateKey, publicKey) = generateKeyPair()
|
||||
|
||||
# Assert the length of the keys
|
||||
assert fieldElementToBytes(privateKey).len == Curve25519KeySize, "Private key size must be 32 bytes"
|
||||
assert fieldElementToBytes(publicKey).len == Curve25519KeySize, "Public key size must be 32 bytes"
|
||||
assert fieldElementToBytes(privateKey).len == FieldElementSize, "Private key size must be 32 bytes"
|
||||
assert fieldElementToBytes(publicKey).len == FieldElementSize, "Public key size must be 32 bytes"
|
||||
|
||||
# Assert that the keys are not empty (i.e., not all zeros)
|
||||
assert privateKey.isNotZero(), "Private key is empty"
|
||||
|
||||
Reference in New Issue
Block a user