diff options
author | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2003-04-16 00:48:47 +0000 |
---|---|---|
committer | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2003-04-16 00:48:47 +0000 |
commit | 4ec1f8462de98d1ad83bd69fbc2142ee4beab620 (patch) | |
tree | 0fd99a2b6f4a82c1b57eb58c91904c2e26cfa911 /shacal2.h | |
parent | b23125460098162f3f93dc876d8326f3de57fe8e (diff) | |
download | cryptopp-4ec1f8462de98d1ad83bd69fbc2142ee4beab620.tar.gz |
add new algorithms (Kevin Springle)
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@57 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'shacal2.h')
-rw-r--r-- | shacal2.h | 53 |
1 files changed, 53 insertions, 0 deletions
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";} +}; + +/// <a href="http://www.weidai.com/scan-mirror/cs.html#SHACAL-2">SHACAL-2</a> +class SHACAL2 : public SHACAL2_Info, public BlockCipherDocumentation +{ + class Base : public BlockCipherBaseTemplate<SHACAL2_Info> + { + public: + void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length); + + protected: + FixedSizeSecBlock<word32, 64> 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, Enc> Encryption; + typedef BlockCipherTemplate<DECRYPTION, Dec> Decryption; +}; + +typedef SHACAL2::Encryption SHACAL2Encryption; +typedef SHACAL2::Decryption SHACAL2Decryption; + +NAMESPACE_END + +#endif |