SEP 10
2005
I just spent quite a while searching around on the web for Diffie-Hellman test vectors. I couldn't find any (beyond some trivially easy explanatory examples). It's hard to believe that there isn't something out there...

Ah well, in the interests of making the web a better place, and in the hopes that somebody will find this and tell me whether these values are correct, here are the Diffie-Hellman values I'm trying to check: I have no idea if they are correct or not.

(All values are expressed as hexadecimal, most significant bit first.)

a = 4400 51d6 f0b5 5ea9 67ab 31c6 8a8b 5e37 
    d910 dae0 e2d4 59a4 8645 9caa df36 7516

b = 5dae c786 7980 a324 8ce3 578f c75f 1b0f 
    2df8 9d30 6fa4 52cd e07a 048a ded9 2656

p = FFFF FFFF FFFF FFFF C90F DAA2 2168 C234 
    C4C6 628B 80DC 1CD1 2902 4E08 8A67 CC74 
    020B BEA6 3B13 9B22 514A 0879 8E34 04DD 
    EF95 19B3 CD3A 431B 302B 0A6D F25F 1437 
    4FE1 356D 6D51 C245 E485 B576 625E 7EC6 
    F44C 42E9 A637 ED6B 0BFF 5CB6 F406 B7ED 
    EE38 6BFB 5A89 9FA5 AE9F 2411 7C4B 1FE6 
    4928 6651 ECE4 5B3D C200 7CB8 A163 BF05 
    98DA 4836 1C55 D39A 6916 3FA8 FD24 CF5F 
    8365 5D23 DCA3 AD96 1C62 F356 2085 52BB 
    9ED5 2907 7096 966D 670C 354E 4ABC 9804 
    F174 6C08 CA18 217C 3290 5E46 2E36 CE3B 
    E39E 772C 180E 8603 9B27 83A2 EC07 A28F 
    B5C5 5DF0 6F4C 52C9 DE2B CBF6 9558 1718 
    3995 497C EA95 6AE5 15D2 2618 98FA 0510 
    1572 8E5A 8AAA C42D AD33 170D 0450 7A33 
    A855 21AB DF1C BA64 ECFB 8504 58DB EF0A 
    8AEA 7157 5D06 0C7D B397 0F85 A6E1 E4C7 
    ABF5 AE8C DB09 33D7 1E8C 94E0 4A25 619D 
    CEE3 D226 1AD2 EE6B F12F FA06 D98A 0864 
    D876 0273 3EC8 6A64 521F 2B18 177B 200C 
    BBE1 1757 7A61 5D6C 7709 88C0 BAD9 46E2 
    08E2 4FA0 74E5 AB31 43DB 5BFC E0FD 108E 
    4B82 D120 A93A D2CA FFFF FFFF FFFF FFFF

g = 2

g^a mod p = 
    5a0d 3d4e 049f aa93 9ffa 6a37 5b9c 3c16 
    a4c3 9753 d19f f7da 36bc 391e a72f c0f6 
    8c92 9bdb 4005 52ed 84e0 900c 7a44 c322 
    2fd5 4d71 4825 6862 886b fb40 16bd 2d03 
    c4c4 cf47 6567 c291 770e 47bd 59d0 aa53 
    23cf ddfc 5596 e0d6 558c 480e e8b0 c625 
    9983 4d45 81a7 96a0 1981 4687 8916 4504 
    afbd 29ce 9936 e86a 290c 5f00 f8ba 986b 
    4801 0f3e 5c07 9c7f 351d dca2 ee1f d508 
    46b3 7bf7 463c 2b0f 3d00 1b13 17ac 3069 
    cd89 e2e4 927e d3d4 0875 a604 9af6 49d2 
    dc34 9db5 995a 7525 d70a 3a1c 9b67 3f54 
    82f8 3343 bd90 d45e 9c39 62dc 4a4b f2b4 
    adb3 7e91 66b2 ddb3 1ccf 11c5 b9e6 c98e 
    0a9a 3377 abba 56b0 f428 3b2e aa69 f536 
    8bc1 07e1 c225 99f8 8dd1 924d 0899 c5f1 
    5346 2c91 1a82 9307 8aef ee9f b238 9a78 
    5483 3fce a61c fecb b49f 828c 361a 981a 
    5fed ecf1 3796 ae36 e36c 15a1 6670 af96 
    996c 3c45 a30e 900e 18c8 58f6 232b 5f70 
    72bd d9e4 7d7f c612 46ef 5d19 7657 39f3 
    8509 2843 79bc 319d 9409 e8fe 236b d29b 
    0335 a5bc 5bb0 424e e44d e8a1 9f86 4a15 
    9fda 907d 6f5a 30eb c0a1 7e36 28e4 90e5

g^b mod p = 
    dc14 c6f6 d85b 3d58 b54a bb30 6d55 6829 
    2ed7 85d3 9ed7 3643 666a 1b4a 4684 654f 
    88bb edf0 414c 59c7 0dd9 90b4 47b3 c325 
    0a4a 2367 3ea9 361a 79be 3376 0906 ef12 
    7627 fa9e 7f91 07e7 3675 9cff 990c 44fc 
    e240 7e7c e1c7 d61a 83b8 5c82 85a9 bf94 
    7cc1 e582 642a 8a86 3e4e 0d57 f258 4b25 
    5229 c4d3 5355 1e86 ac2b bce4 13c7 e554 
    1cc2 e68d 7101 d578 30cd e1c9 1bd4 8c03 
    d190 1472 01f3 9697 f65c c2f4 45e8 5162 
    3bea 585c 8205 d8e8 ca91 b54d aefb 6fe5 
    ac46 e942 b5ea 6e04 495b d2f6 cb11 88c1 
    b44a 342e 5dab 2917 165e 0935 d743 69b7 
    6698 68c9 d4d5 b148 33f3 1e56 9499 1e73 
    353a 33f5 f4dc 61ff 5752 517b 7180 6da2 
    e47e fc78 d22d d8da c4f1 1501 9d57 5d60 
    b787 6140 4413 bff6 e314 329b f1e5 2b92 
    38f8 7964 a5a3 00c7 26c0 950f ac94 6459 
    3c30 6ece 4d92 813f d714 2e16 18b3 efbb 
    3fea 25f9 e177 0859 2507 d8be 73ef d569 
    761e 7ff4 b016 edd0 c5c3 85a8 ec16 1a44 
    f2d6 7c1c 6b39 7d8f 6c3f a797 bcd9 5e3f 
    b8f4 ecba 7ebf 6620 570e f491 4e75 eaf9 
    752b a471 faf7 ccc5 5373 069c 2153 1194

SharedSecret = (g^a mod p)^b mod p = (g^b mod p)^a mod p = 
    bcec d344 c6f4 2f35 aced 542b 7ceb 684a 
    623b f9ad 3ebf 2a64 9afc be7c 9fd2 127e 
    1d2b 08ba b247 3cdd bf44 fa3f 98a5 6ad7 
    5ee7 5a66 e0dc 0bfb c246 fb57 9a6d 5275 
    3222 ea82 e4fc ee51 fef5 3d24 af4c 5f00 
    fdba f7b3 c55a 0e4f 8b5f 2e27 51b5 ca3f 
    9898 8ca3 08b5 11bd 2e35 7767 84dc 852f 
    8519 9eb0 52aa 12a3 b4f5 e9ca be79 8610 
    11a6 c34e 9b11 6f06 fcb3 b59e e739 75cf 
    6529 118f 63b0 68f2 2422 cbac 11e1 18f1 
    fc3a 06c7 9787 f8c0 ee90 f878 64b9 fac6 
    5f75 6725 6abd 1da2 1122 d83e 4026 e9d4 
    835e 5e77 10cd 5ab4 7e88 7d10 dd75 56bf 
    5f27 679d 634a a1c2 f8a8 cfc3 1859 cb72 
    d0e0 8efa 9b01 a88b 213f b604 63fa eb63 
    2449 7b77 4420 76cf 81b9 9556 34dc eeeb 
    bcc1 9b17 1857 d823 d190 798f 391e 1910 
    b7ce eccc baa5 0856 32cf 7660 bb06 9b82 
    721f 7c33 61a4 512b 8a25 ac32 f16e a332 
    2e87 2f54 d2db 8ea7 b815 e125 cd47 b0c6 
    2a51 ae42 5f6c 6956 8ec4 3bb8 810f 62e8 
    447c cb19 0f59 ad1c 212a 50aa 20f0 66c5 
    732c a60e 6728 ea2b c91a 82fe cc80 6f81 
    3330 a694 4aff c69a 562f 3501 514c c70f

SHA-256( SharedSecret ) = 
    2d42 85c2 3196 26f2 c2c7 2c5a 2855 3f54 
    41d2 c521 8c0c fbb6 60cc 57a1 dfa1 a68f

Update: Diceware's Big Number Calculator was built for large numbers! I've verified the numbers above with it.

tags: diffie-hellman crypto
permalink | comments | technorati
blog comments powered by Disqus