aboutsummaryrefslogtreecommitdiff
path: root/src/stable/pearsonhash.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/stable/pearsonhash.h54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/stable/pearsonhash.h b/src/stable/pearsonhash.h
index ca377c1..ece1d40 100644
--- a/src/stable/pearsonhash.h
+++ b/src/stable/pearsonhash.h
@@ -12,35 +12,35 @@
12 12
13namespace Bu 13namespace Bu
14{ 14{
15 /** 15 /**
16 * A pearson hash is a non-cryptographically secure hashing function that 16 * A pearson hash is a non-cryptographically secure hashing function that
17 * is very light on resources, very fast, and produces a single byte 17 * is very light on resources, very fast, and produces a single byte
18 * as it's output. It is strongly dependant on every byte in the input, 18 * as it's output. It is strongly dependant on every byte in the input,
19 * which means that it's a good choice for adding to short messages to 19 * which means that it's a good choice for adding to short messages to
20 * ensure that the contents of the messages are unchanged. 20 * ensure that the contents of the messages are unchanged.
21 * 21 *
22 * Pearson hash is named for it's inventor Peter K. Pearson who described 22 * Pearson hash is named for it's inventor Peter K. Pearson who described
23 * it in his article "Fast hashing of variable-length text strings" 23 * it in his article "Fast hashing of variable-length text strings"
24 * published in 1990 by ACM. I haven't read it, because you have to pay to 24 * published in 1990 by ACM. I haven't read it, because you have to pay to
25 * get a copy :-P 25 * get a copy :-P
26 */ 26 */
27 class PearsonHash : public Bu::CryptoHash 27 class PearsonHash : public Bu::CryptoHash
28 { 28 {
29 public: 29 public:
30 PearsonHash(); 30 PearsonHash();
31 virtual ~PearsonHash(); 31 virtual ~PearsonHash();
32 32
33 virtual void reset(); 33 virtual void reset();
34 virtual void setSalt( const Bu::String &sSalt ); 34 virtual void setSalt( const Bu::String &sSalt );
35 virtual void addData( const void *sData, int iSize ); 35 virtual void addData( const void *sData, int iSize );
36 using Bu::CryptoHash::addData; 36 using Bu::CryptoHash::addData;
37 virtual String getResult(); 37 virtual String getResult();
38 virtual void writeResult( Stream &sOut ); 38 virtual void writeResult( Stream &sOut );
39 39
40 private: 40 private:
41 static uint8_t aSBox[256]; 41 static uint8_t aSBox[256];
42 uint8_t iValue; 42 uint8_t iValue;
43 }; 43 };
44}; 44};
45 45
46#endif 46#endif