aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/hash/skein/skein_512.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2014-02-08 14:20:48 +0000
committerlloyd <[email protected]>2014-02-08 14:20:48 +0000
commitfd9b6a6cd6ce791cf2593a23bde4174daeebb05a (patch)
tree3b96f3500d46642acc984e68759f2da047d9e9ae /src/lib/hash/skein/skein_512.h
parentc2915d84b213f3bba8fc68d1d2c035289f7c8d11 (diff)
Have Skein call Threefish, rather than duplicating the code.
Diffstat (limited to 'src/lib/hash/skein/skein_512.h')
-rw-r--r--src/lib/hash/skein/skein_512.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/lib/hash/skein/skein_512.h b/src/lib/hash/skein/skein_512.h
index e0abc06ae..1fd514cf5 100644
--- a/src/lib/hash/skein/skein_512.h
+++ b/src/lib/hash/skein/skein_512.h
@@ -1,6 +1,6 @@
/*
* The Skein-512 hash function
-* (C) 2009 Jack Lloyd
+* (C) 2009,2014 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
@@ -8,9 +8,10 @@
#ifndef BOTAN_SKEIN_512_H__
#define BOTAN_SKEIN_512_H__
-#include <botan/secmem.h>
#include <botan/hash.h>
+#include <botan/threefish.h>
#include <string>
+#include <memory>
namespace Botan {
@@ -35,13 +36,29 @@ class BOTAN_DLL Skein_512 : public HashFunction
std::string name() const;
void clear();
private:
+ enum type_code {
+ SKEIN_KEY = 0,
+ SKEIN_CONFIG = 4,
+ SKEIN_PERSONALIZATION = 8,
+ SKEIN_PUBLIC_KEY = 12,
+ SKEIN_KEY_IDENTIFIER = 16,
+ SKEIN_NONCE = 20,
+ SKEIN_MSG = 48,
+ SKEIN_OUTPUT = 63
+ };
+
void add_data(const byte input[], size_t length);
void final_result(byte out[]);
+ void ubi_512(const byte msg[], size_t msg_len);
+
+ void initial_block();
+ void reset_tweak(type_code type, bool final);
+
std::string personalization;
size_t output_bits;
- secure_vector<u64bit> H;
+ std::unique_ptr<Threefish_512> m_threefish;
secure_vector<u64bit> T;
secure_vector<byte> buffer;
size_t buf_pos;