aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/hash/sha2_64/sha2_64.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2015-01-08 01:11:17 +0000
committerlloyd <[email protected]>2015-01-08 01:11:17 +0000
commit718d577455c2e431e32064950f2612e1381c275a (patch)
treef7fbbad052a82c9f17309f64f3de7e2cec5ad603 /src/lib/hash/sha2_64/sha2_64.h
parent624787ec08f215a7b0be51ceeeb211a717bf7f50 (diff)
Add SHA-512/256
Define some new functions for copying out arrays of words and use them across hashes.
Diffstat (limited to 'src/lib/hash/sha2_64/sha2_64.h')
-rw-r--r--src/lib/hash/sha2_64/sha2_64.h30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/lib/hash/sha2_64/sha2_64.h b/src/lib/hash/sha2_64/sha2_64.h
index 58b154170..33bcb1100 100644
--- a/src/lib/hash/sha2_64/sha2_64.h
+++ b/src/lib/hash/sha2_64/sha2_64.h
@@ -1,6 +1,6 @@
/*
* SHA-{384,512}
-* (C) 1999-2010 Jack Lloyd
+* (C) 1999-2010,2015 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
@@ -24,13 +24,13 @@ class BOTAN_DLL SHA_384 : public MDx_HashFunction
void clear();
- SHA_384() : MDx_HashFunction(128, true, true, 16), digest(8)
+ SHA_384() : MDx_HashFunction(128, true, true, 16), m_digest(8)
{ clear(); }
private:
void compress_n(const byte[], size_t blocks);
void copy_out(byte[]);
- secure_vector<u64bit> digest;
+ secure_vector<u64bit> m_digest;
};
/**
@@ -45,13 +45,33 @@ class BOTAN_DLL SHA_512 : public MDx_HashFunction
void clear();
- SHA_512() : MDx_HashFunction(128, true, true, 16), digest(8)
+ SHA_512() : MDx_HashFunction(128, true, true, 16), m_digest(8)
{ clear(); }
private:
void compress_n(const byte[], size_t blocks);
void copy_out(byte[]);
- secure_vector<u64bit> digest;
+ secure_vector<u64bit> m_digest;
+ };
+
+/**
+* SHA-512/256
+*/
+class BOTAN_DLL SHA_512_256 : public MDx_HashFunction
+ {
+ public:
+ std::string name() const { return "SHA-512/256"; }
+ size_t output_length() const { return 32; }
+ HashFunction* clone() const { return new SHA_512_256; }
+
+ void clear();
+
+ SHA_512_256() : MDx_HashFunction(128, true, true, 16), m_digest(8) { clear(); }
+ private:
+ void compress_n(const byte[], size_t blocks);
+ void copy_out(byte[]);
+
+ secure_vector<u64bit> m_digest;
};
}