| 1 | ### Tests for X25519. |
| 2 | |
| 3 | x25519 { |
| 4 | ## These are from Daniel J. Bernstein, `Cryptography in NaCl', 2009-03-10, |
| 5 | ## https://cr.yp.to/highspeed/naclcrypto-20090310.pdf |
| 6 | |
| 7 | ## Make Alice's public key. |
| 8 | 77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a |
| 9 | 0900000000000000000000000000000000000000000000000000000000000000 |
| 10 | 8520f0098930a754748b7ddcb43ef75a0dbf3a0d26381af4eba4a98eaa9b4e6a; |
| 11 | |
| 12 | ## Make Bob's public key. |
| 13 | 5dab087e624a8a4b79e17f8b83800ee66f3bb1292618b6fd1c2f8b27ff88e0eb |
| 14 | 0900000000000000000000000000000000000000000000000000000000000000 |
| 15 | de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f; |
| 16 | |
| 17 | ## Make the shared secret using Alice's private key. |
| 18 | 77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a |
| 19 | de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f |
| 20 | 4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742; |
| 21 | |
| 22 | ## Make the (same) shared secret using Bob's private key. |
| 23 | 5dab087e624a8a4b79e17f8b83800ee66f3bb1292618b6fd1c2f8b27ff88e0eb |
| 24 | 8520f0098930a754748b7ddcb43ef75a0dbf3a0d26381af4eba4a98eaa9b4e6a |
| 25 | 4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742; |
| 26 | |
| 27 | ## These tests are from RFC7748. I've clamped the public values because |
| 28 | ## RFC7748 wants the top bits ignored. |
| 29 | a546e36bf0527c9d3b16154b82465edd62144c0ac1fc5a18506a2244ba449ac4 |
| 30 | e6db6867583030db3594c1a424b15f7c726624ec26b3353b10a903a6d0ab1c4c |
| 31 | c3da55379de9c6908e94ea4df28d084f32eccf03491c71f754b4075577a28552; |
| 32 | 4b66e9d4d1b4673c5ad22691957d6af5c11b6421e0ea01d42ca4169e7918ba0d |
| 33 | e5210f12786811d3f4b7959d0538ae2c31dbe7106fc03c3efc4cd549c715a413 |
| 34 | 95cbde9476e8907d7aade45cb4b873f88b595a68799fa152e6f8f7647aac7957; |
| 35 | } |
| 36 | |
| 37 | x25519-mct { |
| 38 | ## These tests are from RFC7748. |
| 39 | |
| 40 | 0900000000000000000000000000000000000000000000000000000000000000 |
| 41 | 0900000000000000000000000000000000000000000000000000000000000000 |
| 42 | 1 422c8e7a6227d7bca1350b3e2bb7279f7897b87bb6854b783c60e80311ae3079; |
| 43 | 422c8e7a6227d7bca1350b3e2bb7279f7897b87bb6854b783c60e80311ae3079 |
| 44 | 0900000000000000000000000000000000000000000000000000000000000000 |
| 45 | 9 7b96f292a115e83e78560105869c00b0f4fb2cd10e385b8c64bf047b0c0e1113; |
| 46 | 7b96f292a115e83e78560105869c00b0f4fb2cd10e385b8c64bf047b0c0e1113 |
| 47 | 15ede295d28b07a10484dab4c591580dea0a9181591f20c364c1b26387200466 |
| 48 | 90 b1a5a73158904c020866c13939dd7e1aa26852ee1d2609c92e5a8f1debe2150a; |
| 49 | b1a5a73158904c020866c13939dd7e1aa26852ee1d2609c92e5a8f1debe2150a |
| 50 | 4f5d42724afd7c6e46259e753d3f9e186b72c47f692881c0d069c481ddaf3362 |
| 51 | 900 684cf59ba83309552800ef566f2f4d3c1c3887c49360e3875f2eb94d99532c51; |
| 52 | } |