From 4ec1f8462de98d1ad83bd69fbc2142ee4beab620 Mon Sep 17 00:00:00 2001 From: weidai Date: Wed, 16 Apr 2003 00:48:47 +0000 Subject: add new algorithms (Kevin Springle) git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@57 57ff6487-cd31-0410-9ec3-f628ee90f5f0 --- shacal2.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 shacal2.h (limited to 'shacal2.h') diff --git a/shacal2.h b/shacal2.h new file mode 100644 index 0000000..8208760 --- /dev/null +++ b/shacal2.h @@ -0,0 +1,53 @@ +#ifndef CRYPTOPP_SHACAL2_H +#define CRYPTOPP_SHACAL2_H + +/** \file +*/ + +#include "seckey.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +struct SHACAL2_Info : public FixedBlockSize<32>, public VariableKeyLength<16, 16, 64> +{ + static const char *StaticAlgorithmName() {return "SHACAL-2";} +}; + +/// SHACAL-2 +class SHACAL2 : public SHACAL2_Info, public BlockCipherDocumentation +{ + class Base : public BlockCipherBaseTemplate + { + public: + void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length); + + protected: + FixedSizeSecBlock m_key; + + static const word32 K[64]; + }; + + class Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + + class Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + +public: + typedef BlockCipherTemplate Encryption; + typedef BlockCipherTemplate Decryption; +}; + +typedef SHACAL2::Encryption SHACAL2Encryption; +typedef SHACAL2::Decryption SHACAL2Decryption; + +NAMESPACE_END + +#endif -- cgit v1.2.1