os/ossrv/ofdbus/dbus/data/sha-1/Readme.txt
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ofdbus/dbus/data/sha-1/Readme.txt	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,83 @@
     1.4 +Test suite from http://csrc.nist.gov/cryptval/shs.html
     1.5 +
     1.6 +				Sample Vectors for SHA-1 Testing
     1.7 +
     1.8 +	This file describes tests and vectors that can be used in verifying the correctness of 
     1.9 +an SHA-1 implementation.  However, use of these vectors does not take the place of validation 
    1.10 +obtained through the Cryptographic Module Validation Program.
    1.11 +
    1.12 +	There are three areas of the Secure Hash Standard for which test vectors are supplied:
    1.13 +short messages of varying length, selected long messages, and pseudorandomly generated messages.
    1.14 +Since it is possible for an implementation to correctly handle the hashing of byte-oriented
    1.15 +messages (and not messages of a non-byte length), the SHS tests each come in two flavors.  For
    1.16 +both byte oriented and bit oriented messages, the message lengths are given in bits.
    1.17 +
    1.18 +Type I Test: Messages of Varying Length
    1.19 +
    1.20 +	An implementation of the SHS must be able to correctly generate message digests for
    1.21 +messages of arbitrary length.  This functionality can be tested by supplying the implementation
    1.22 +with 1025 pseudorandomly generated messages with lengths from 0 to 1024 bits (for an implementation
    1.23 +that only hashes byte-oriented data correctly, 129 messages of length 0, 8, 16, 24,...,1024 bits
    1.24 +will be supplied).
    1.25 +
    1.26 +Type II Test: Selected Long Messages
    1.27 +
    1.28 +	Additional testing of an implementation can be performed by testing that the implementation
    1.29 +can correctly generate digests for longer messages.  A list of 100 messages, each of length > 1024,
    1.30 +is supplied.  These can be used to verify the hashing of longer message lengths.  For bit oriented
    1.31 +testing the messages are from 1025 to 103425 bits long (length=1025+i*1024, where 0<=i<100).  For
    1.32 +byte oriented testing the messages are from 1032 to 103432 (length=1032+i*1024, where 0<=i<100).
    1.33 +
    1.34 +Type III Test: Pseudorandomly Generated Messages
    1.35 +
    1.36 +	This test determines whether the implementation can compute message digests for messages
    1.37 +that are generated using a given seed.  A sequence of 100 message digests is generated using this
    1.38 +seed.  The digests are generated according to the following pseudocode:
    1.39 +
    1.40 +procedure MonteCarlo(string SEED)
    1.41 +{
    1.42 +	integer i, j, a;
    1.43 +	string	M;
    1.44 +
    1.45 +	M := SEED;
    1.46 +	for j = 0 to 99 do {
    1.47 +		for i = 1 to 50000 do {
    1.48 +			for a = 1 to (j/4*8 + 24) do M := M || ’0’;	/*‘0' is the binary zero bit. */
    1.49 +			M := M || i; 	/* Here, the value for ‘i’ is expressed as a 32-bit word
    1.50 +					   and concatenated with ‘M’. The first bit
    1.51 +					   concatenated with ‘M’ is the most significant bit of
    1.52 +					   this 32-bit word. */
    1.53 +			M := SHA(M);
    1.54 +			}
    1.55 +		print(M);
    1.56 +		}
    1.57 +	}
    1.58 +
    1.59 +NOTE: In the above procedure, || denotes concatenation. Also, M || i denotes appending the 32-bit
    1.60 +word representing the value ‘i’, as defined in section 2 of the SHS.  Within the procedure, M is a string
    1.61 +of variable length. The initial length of 416 bits ensures that the length of M never exceeds 512 bits
    1.62 +during execution of the above procedure, and it ensures that messages will be of a byte length.  Each
    1.63 +element printed should be 160 bits in length.
    1.64 +
    1.65 +
    1.66 +File formats:
    1.67 +
    1.68 +There are two files included for each test type (bit-oriented and byte-oriented).  One file contains
    1.69 +the messages and the other file contains the hashes.
    1.70 +
    1.71 +The message files provided use "compact strings" to store the message values.  Compact strings are 
    1.72 +used to represented the messages in a compact form.  A compact string has the form
    1.73 +	z || b || n(1) || n(2) || ... || n(z)
    1.74 +where z>=0 that represents the number of n, b is either 0 or 1, and each n(i) is a decimal integer
    1.75 +representing a positive number.  The length of the compact string is given by the summation of the n(i).
    1.76 +
    1.77 +The compact string is interpreted as the representation of the bit string consisting of b repeated n(1) times,
    1.78 +followed by 1-b repeated n(2) times, followed by b repeated n(3) times, and so on.
    1.79 +
    1.80 +Example:
    1.81 +	M = 5 1 7 13 5 1 2
    1.82 +	where z = 5 and b = 1.  Then the compact string M represents the bit string
    1.83 +	1111111000000000000011111011
    1.84 +	where 1 is repeated 7 times, 0 is repeated 13 times, 1 is repeated 5 times,
    1.85 +	0 is repeated 1 time, and 1 is repeated 2 times.
    1.86 +