diff options
author | weidai <weidai11@users.noreply.github.com> | 2003-04-16 00:48:47 +0000 |
---|---|---|
committer | weidai <weidai11@users.noreply.github.com> | 2003-04-16 00:48:47 +0000 |
commit | 15ff20029891b78641bc0027c95a033c3f6dc592 (patch) | |
tree | 0fd99a2b6f4a82c1b57eb58c91904c2e26cfa911 /shacal2.h | |
parent | 397f566bf7648470ef40f8fb4dc25c3f3b269203 (diff) | |
download | cryptopp-git-15ff20029891b78641bc0027c95a033c3f6dc592.tar.gz |
add new algorithms (Kevin Springle)
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 00000000..8208760e --- /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 |