00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _CSSHA256_H
00023 #define _CSSHA256_H
00024
00025 #include "csextern.h"
00026 #include "csutil/csstring.h"
00027 #include "csutil/digest.h"
00028 #include "csutil/hash.h"
00029
00030 namespace CS
00031 {
00032 namespace Utility
00033 {
00034 namespace Checksum
00035 {
00044 class CS_CRYSTALSPACE_EXPORT SHA256
00045 {
00047
00048 uint32 total[2];
00049 uint32 state[8];
00050 uint8 buffer[64];
00052
00057 void Process (const uint8 data[64]);
00059 void AppendInternal (const uint8* input, uint32 length);
00064 void Finish (uint8 digest[32]);
00065 public:
00067 typedef CS::Utility::Checksum::Digest<32> Digest;
00068
00069 SHA256 ();
00070
00076 void Append (const uint8* input, size_t length);
00077
00084 Digest Finish ();
00085
00087 static Digest Encode(csString const&);
00089 static Digest Encode(const char*);
00091 static Digest Encode(const void*, size_t nbytes);
00092 };
00093
00094 }
00095 }
00096 }
00097
00098
00099 #endif // _CSSHA256_H