void sha1_ctx2hash (sha1_hash_t *dest, sha1_ctx_t *state){
#if defined LITTLE_ENDIAN
uint8_t i;
- for(i=0; i<8; ++i){
+ for(i=0; i<5; ++i){
((uint32_t*)dest)[i] = change_endian32(state->h[i]);
}
#elif BIG_ENDIAN
if (dest != state->h)
- memcpy(dest, state->h, SHA256_HASH_BITS/8);
+ memcpy(dest, state->h, SHA1_HASH_BITS/8);
#else
# error unsupported endian type!
#endif
sha1(&hash,"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",448);
// cli_putstr_P(PSTR("\r\nsha1(\"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq\") = \r\n\t"));
cli_hexdump(hash,SHA1_HASH_BITS/8);
-/*
cli_putstr("\r\nsha1(1,000,000 * 'a') = \r\n\t");
{
uint8_t block[SHA1_BLOCK_BITS/8];
sha1_ctx2hash(&hash, &s);
}
cli_hexdump(hash,SHA1_HASH_BITS/8);
-*/
- cli_putstr("\r\nx");
}