Skip to content

Add comprehensive test vectors across all algorithm crates#1373

Open
karthikbhargavan wants to merge 2 commits intomainfrom
add/wycheproof-test-vectors
Open

Add comprehensive test vectors across all algorithm crates#1373
karthikbhargavan wants to merge 2 commits intomainfrom
add/wycheproof-test-vectors

Conversation

@karthikbhargavan
Copy link
Copy Markdown
Contributor

@karthikbhargavan karthikbhargavan commented Mar 23, 2026

I used Claude to generate Wycheproof tests for all the algorithms, and to add other test vectors.
This PR is the result.

  • New Wycheproof tests: hkdf (SHA-256/384/512), hmac (SHA-1/256/384/512), curve25519 (X25519 ECDH), p256 (ECDH)
  • Migrate chacha20poly1305 and ecdsa from custom JSON parsing to typed wycheproof crate API; add ECDSA SHA-512 coverage and invalid vector testing
  • Add CAVP test vectors for sha2 (SHA-224/256/384/512 ShortMsg + LongMsg)
  • Add test vectors for blake2 (BLAKE2b-256 and BLAKE2s-256, keyed + unkeyed)
  • Add test vectors for poly1305 (24 vectors with various input sizes)
 ┌───────────────────┬─────────────────────────────┬────────────────────────────────────────────────────────┐
  │     Algorithm     │        Test Vectors         │                         Source                         │
  ├───────────────────┼─────────────────────────────┼────────────────────────────────────────────────────────┤
  │ HKDF              │ 252 (86 + 83 + 83)          │ Wycheproof (SHA-256/384/512)                           │
  ├───────────────────┼─────────────────────────────┼────────────────────────────────────────────────────────┤
  │ HMAC              │ 692 (170 + 174 + 174 + 174) │ Wycheproof (SHA-1/256/384/512)                         │
  ├───────────────────┼─────────────────────────────┼────────────────────────────────────────────────────────┤
  │ X25519            │ 518                         │ Wycheproof                                             │
  ├───────────────────┼─────────────────────────────┼────────────────────────────────────────────────────────┤
  │ P-256 ECDH        │ 355                         │ Wycheproof                                             │
  ├───────────────────┼─────────────────────────────┼────────────────────────────────────────────────────────┤
  │ ChaCha20-Poly1305 │ 622 (316 + 306)             │ Wycheproof (migrated from custom JSON)                 │
  ├───────────────────┼─────────────────────────────┼────────────────────────────────────────────────────────┤
  │ ECDSA P-256       │ 1,012 (471 + 541)           │ Wycheproof SHA-256 + SHA-512 (migrated, added SHA-512) │
  ├───────────────────┼─────────────────────────────┼────────────────────────────────────────────────────────┤
  │ SHA-2             │ 68 (17 × 4 variants)        │ CAVP-format (SHA-224/256/384/512)                      │
  ├───────────────────┼─────────────────────────────┼────────────────────────────────────────────────────────┤
  │ BLAKE2            │ 48 (24 + 24)                │ Generated (BLAKE2b-256 + BLAKE2s-256, keyed + unkeyed) │
  ├───────────────────┼─────────────────────────────┼────────────────────────────────────────────────────────┤
  │ Poly1305          │ 24                          │ Generated (various input sizes)                        │
  ├───────────────────┼─────────────────────────────┼────────────────────────────────────────────────────────┤
  │ Total             │ ~3,591                      │                                                        │
  └───────────────────┴─────────────────────────────┴────────────────────────────────────────────────────────┘

[skip changelog]

- New Wycheproof tests: hkdf (SHA-256/384/512), hmac (SHA-1/256/384/512),
  curve25519 (X25519 ECDH), p256 (ECDH)
- Migrate chacha20poly1305 and ecdsa from custom JSON parsing to typed
  wycheproof crate API; add ECDSA SHA-512 coverage and invalid vector testing
- Add CAVP test vectors for sha2 (SHA-224/256/384/512 ShortMsg + LongMsg)
- Add test vectors for blake2 (BLAKE2b-256 and BLAKE2s-256, keyed + unkeyed)
- Add test vectors for poly1305 (24 vectors with various input sizes)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@karthikbhargavan karthikbhargavan requested review from a team as code owners March 23, 2026 11:03
@karthikbhargavan karthikbhargavan requested a review from keks March 23, 2026 11:03
@jschneider-bensch jschneider-bensch added the waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 24, 2026
@jschneider-bensch jschneider-bensch requested review from jschneider-bensch and removed request for keks March 24, 2026 09:17
@jschneider-bensch
Copy link
Copy Markdown
Collaborator

More tests is good, however, I need to review everything is at the right place here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants