Skip to content

Commit

Permalink
Added .changes file
Browse files Browse the repository at this point in the history
  • Loading branch information
melatron committed Feb 18, 2021
1 parent 0cca948 commit 56f1c11
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changes/add-ed25519-tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"iota-crypto": minor
---

Add ed25519 test suite.
8 changes: 4 additions & 4 deletions tests/x25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ fn test_x25519_rfc7748() -> crypto::Result<()> {
for tv in tvs.iter() {
let secret_a: SecretKey = {
let bytes = hex::decode(tv.secret_a).unwrap();
SecretKey::from_bytes(&bytes).unwrap()
SecretKey::from_bytes(&bytes)?
};

let public_a: Option<PublicKey> = {
let bytes = tv.public_a.map(hex::decode).transpose().unwrap();
bytes.map(|bytes| PublicKey::from_bytes(&bytes)).transpose().unwrap()
bytes.map(|bytes| PublicKey::from_bytes(&bytes)).transpose()?
};

let secret_b: Option<SecretKey> = {
let bytes = tv.secret_b.map(hex::decode).transpose().unwrap();
bytes.map(|bytes| SecretKey::from_bytes(&bytes)).transpose().unwrap()
bytes.map(|bytes| SecretKey::from_bytes(&bytes)).transpose()?
};

let public_b: PublicKey = {
let bytes = hex::decode(tv.public_b).unwrap();
PublicKey::from_bytes(&bytes).unwrap()
PublicKey::from_bytes(&bytes)?
};

let expected: Vec<u8> = hex::decode(tv.shared).unwrap();
Expand Down
7 changes: 4 additions & 3 deletions utils/test_vectors/py/ed25519_sign_transform.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import sys
import binascii

#generates ed25519_sign.rs by using python3 ed25519_sign_transform.py < sign.input > ed25519_sign.rs
# generates ed25519_sign.rs by using python3 ed25519_sign_transform.py < sign.input > ed25519_sign.rs
print("[")
while 1:
line = sys.stdin.readline()
if not line: break
if not line:
break
x = line.split(':')

# 64-byte secret key - it consists of 32-byte seed and 32 additional bytes which
Expand All @@ -23,4 +24,4 @@
print(f" signature: \"{sig.hex()}\",")
print(" },")

print("]")
print("]")

0 comments on commit 56f1c11

Please sign in to comment.