SHA256.h revision 6aff37d1
1/*
2 * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _SHA_256_H
6#define _SHA_256_H
7
8
9#include <SupportDefs.h>
10
11
12#define SHA_DIGEST_LENGTH	32
13
14namespace BPrivate {
15
16
17class SHA256 {
18public:
19								SHA256();
20								~SHA256();
21
22			void				Init();
23			void				Update(const void* buffer, size_t size);
24			const uint8*		Digest();
25			size_t				DigestLength() const
26									{ return SHA_DIGEST_LENGTH; }
27
28private:
29			void				_ProcessChunk();
30
31private:
32			uint32				fHash[8];
33			uint32				fDigest[8];
34			uint32				fBuffer[64];
35			size_t				fBytesInBuffer;
36			size_t				fMessageSize;
37			bool				fDigested;
38};
39
40
41} // namespace BPrivate
42
43using BPrivate::SHA256;
44
45
46#endif	// _SHA_256_H
47