[4237] in cryptography@c2.net mail archive
SHA-1 bitwise test vectors (Re: RSA Test)
daemon@ATHENA.MIT.EDU (Jim Gillogly)
Tue Feb 23 13:52:46 1999
Date: Tue, 23 Feb 1999 09:19:40 -0800
From: Jim Gillogly <jim@acm.org>
Reply-To: jim@acm.org
To: ukcrypto@maillist.ox.ac.uk, cryptography@c2.net
"Hani Almansour" <Almansour@bigfoot.com> wrote:
> I have implementation for RSA, SHA, MD5 and I want to test it. is there a
> fast way to test the output of any one of these encryption or if there is a
> program that test the output.
For the basic SHA-1 and MD5 you can use the test vectors published in
the specifications to see whether you have the basic idea right.
However, there are a lot of places to go wrong if you're implementing
the full SHA-1, which is defined for arbitrary bit strings. Francois
Grieu and I have agreed on a number of SHA-1 bit strings and their hashes
to test problem areas where the internal buffers fill and roll over. This
should shake out most of your bugs.
In the following we use the notation bitstring#n to mean a bitstring
repeated n (in decimal) times, and we use | for concatenation. Therefore
110#3|1 is 1101101101.
110#148|11 : CE7387AE 577337BE 54EA94F8 2C842E8B E76BC3E1
110#149 : DE244F06 3142CB2F 4C903B7F 7660577F 9E0D8791
110#149|1 : A3D29824 27AE39C8 920CA5F4 99D6C2BD 71EBF03C
110#149|11 : 351AAB58 FF93CF12 AF7D5A58 4CFC8F7D 81023D10
110#170 : 99638692 1E480D4E 2955E727 5DF3522C E8F5AB6E
110#170|1 : BB5F4AD4 8913F51B 157EB985 A5C2034B 8243B01B
110#170|11 : 9E92C554 2237B957 BA2244E8 141FDB66 DEC730A5
110#171 : 2103E454 DA4491F4 E32DD425 A3341DC9 C2A90848
011#490 : B4B18049 DE405027 528CD9E7 4B2EC540 D4E6F06B
011#490|0 : 34C63356 B3087427 20AB9669 14EB0FC9 26E4294B
011#490|01 : 75FACE18 02B9F84F 326368AB 06E73E05 02E9EA34
011#491 : 7C2C3D62 F6AEC28D 94CDF93F 02E739E7 490698A1
Here is a set near 2^32 bits to test the roll-over in the length
field from one to two 32-bit words:
110#1431655764|11 1eef5a18 969255a3 b1793a2a 955c7ec2 8cd221a5
110#1431655765| 7a1045b9 14672afa ce8d90e6 d19b3a6a da3cb879
110#1431655765|1 d5e09777 a94f1ea9 240874c4 8d9fecb6 b634256b
110#1431655765|11 eb256904 3c3014e5 1b2862ae 6eb5fb4e 0b851d99
011#1431655764|01 4CB0C4EF 69143D5B F34FC35F 1D4B19F6 ECCAE0F2
011#1431655765 47D92F91 1FC7BB74 DE00ADFC 4E981A81 05556D52
011#1431655765|0 A3D7438C 589B0B93 2AA91CC2 446F06DF 9ABC73F0
011#1431655765|01 3EEE3E1E 28DEDE2C A444D68D A5675B2F AAAB3203
There are lots of cases where one might go wrong, so if you're
likely to do a partial-byte implementation you might want to
hang onto these test vectors, which were performed with quite
different implementations.
--
Jim Gillogly
Sterday, 3 Rethe S.R. 1999, 17:11
12.19.5.17.8, 9 Lamat 1 Kayab, Sixth Lord of Night