1
////////////////////////////////////////////////////////////////////////////
2
// NoteCase notes manager project <http://notecase.sf.net>
4
// This code is licensed under BSD license.See "license.txt" for more details.
6
// File: Class implements SHA1 hashing algorithm
7
////////////////////////////////////////////////////////////////////////////
10
100% free public domain implementation of the SHA-1 algorithm
12
=== Test Vectors (from FIPS PUB 180-1) ===
15
A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
17
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
18
84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
20
A million repetitions of "a"
21
34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
31
#define MAX_FILE_READ_BUFFER 8000
36
enum { REPORT_HEX = 0, REPORT_DIGIT = 1 };
41
unsigned long m_state[5];
42
unsigned long m_count[2];
43
unsigned char m_buffer[64];
44
unsigned char m_digest[20];
48
void Update (unsigned char* data, unsigned int len);
49
bool HashFile (char *szFileName);
52
void ReportHash (char *szReport, unsigned char uReportType = REPORT_HEX);
53
void GetHash (unsigned char *uDest);
56
void Transform (unsigned long state[5], unsigned char buffer[64]);