aboutsummaryrefslogtreecommitdiff
path: root/src/stable/sha1.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/stable/sha1.h70
1 files changed, 35 insertions, 35 deletions
diff --git a/src/stable/sha1.h b/src/stable/sha1.h
index e861f94..f882473 100644
--- a/src/stable/sha1.h
+++ b/src/stable/sha1.h
@@ -13,41 +13,41 @@
13 13
14namespace Bu 14namespace Bu
15{ 15{
16 /** 16 /**
17 * Calculates SHA-1 sums. This is based strongly on code from Michael D. 17 * Calculates SHA-1 sums. This is based strongly on code from Michael D.
18 * Leonhard who released his code under the terms of the MIT license, 18 * Leonhard who released his code under the terms of the MIT license,
19 * thank you! Check out his website http://tamale.net he has a lot of 19 * thank you! Check out his website http://tamale.net he has a lot of
20 * cool stuff there. 20 * cool stuff there.
21 */ 21 */
22 class Sha1 : public CryptoHash 22 class Sha1 : public CryptoHash
23 { 23 {
24 public: 24 public:
25 Sha1(); 25 Sha1();
26 virtual ~Sha1(); 26 virtual ~Sha1();
27 27
28 virtual void reset(); 28 virtual void reset();
29 virtual void setSalt( const Bu::String &sSalt ); 29 virtual void setSalt( const Bu::String &sSalt );
30 virtual void addData( const void *sData, int iSize ); 30 virtual void addData( const void *sData, int iSize );
31 using CryptoHash::addData; 31 using CryptoHash::addData;
32 virtual String getResult(); 32 virtual String getResult();
33 virtual void writeResult( Stream &sOut ); 33 virtual void writeResult( Stream &sOut );
34 34
35 void update( const char* data, int num ); 35 void update( const char* data, int num );
36 unsigned char* getDigest(); 36 unsigned char* getDigest();
37 37
38 // utility methods 38 // utility methods
39 39
40 private: 40 private:
41 static uint32_t lrot( uint32_t x, int bits ); 41 static uint32_t lrot( uint32_t x, int bits );
42 static void toBigEndian( uint32_t in, unsigned char* out ); 42 static void toBigEndian( uint32_t in, unsigned char* out );
43 void process(); 43 void process();
44 44
45 private: 45 private:
46 uint32_t uH0, uH1, uH2, uH3, uH4; 46 uint32_t uH0, uH1, uH2, uH3, uH4;
47 unsigned char uBytes[64]; 47 unsigned char uBytes[64];
48 int iUnprocessedBytes; 48 int iUnprocessedBytes;
49 uint32_t uTotalBytes; 49 uint32_t uTotalBytes;
50 }; 50 };
51}; 51};
52 52
53#endif 53#endif