aboutsummaryrefslogtreecommitdiff
path: root/src/pearsonhash.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pearsonhash.h')
-rw-r--r--src/pearsonhash.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/pearsonhash.h b/src/pearsonhash.h
new file mode 100644
index 0000000..af8dfc3
--- /dev/null
+++ b/src/pearsonhash.h
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
8#ifndef BU_PEARSON_HASH_H
9#define BU_PEARSON_HASH_H
10
11#include "bu/cryptohash.h"
12
13namespace Bu
14{
15 /**
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
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
20 * ensure that the contents of the messages are unchanged.
21 */
22 class PearsonHash : public Bu::CryptoHash
23 {
24 public:
25 PearsonHash();
26 virtual ~PearsonHash();
27
28 virtual void reset();
29 virtual void setSalt( const Bu::String &sSalt );
30 virtual void addData( const void *sData, int iSize );
31 using Bu::CryptoHash::addData;
32 virtual String getResult();
33 virtual void writeResult( Stream &sOut );
34
35 private:
36 static uint8_t aSBox[256];
37 uint8_t iValue;
38 };
39};
40
41#endif