Crypto++
|
00001 #ifndef CRYPTOPP_SHACAL2_H 00002 #define CRYPTOPP_SHACAL2_H 00003 00004 /** \file 00005 */ 00006 00007 #include "seckey.h" 00008 #include "secblock.h" 00009 00010 NAMESPACE_BEGIN(CryptoPP) 00011 00012 //! _ 00013 struct SHACAL2_Info : public FixedBlockSize<32>, public VariableKeyLength<16, 16, 64> 00014 { 00015 static const char *StaticAlgorithmName() {return "SHACAL-2";} 00016 }; 00017 00018 /// <a href="http://www.weidai.com/scan-mirror/cs.html#SHACAL-2">SHACAL-2</a> 00019 class SHACAL2 : public SHACAL2_Info, public BlockCipherDocumentation 00020 { 00021 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SHACAL2_Info> 00022 { 00023 public: 00024 void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); 00025 00026 protected: 00027 FixedSizeSecBlock<word32, 64> m_key; 00028 00029 static const word32 K[64]; 00030 }; 00031 00032 class CRYPTOPP_NO_VTABLE Enc : public Base 00033 { 00034 public: 00035 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 00036 }; 00037 00038 class CRYPTOPP_NO_VTABLE Dec : public Base 00039 { 00040 public: 00041 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 00042 }; 00043 00044 public: 00045 typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption; 00046 typedef BlockCipherFinal<DECRYPTION, Dec> Decryption; 00047 }; 00048 00049 typedef SHACAL2::Encryption SHACAL2Encryption; 00050 typedef SHACAL2::Decryption SHACAL2Decryption; 00051 00052 NAMESPACE_END 00053 00054 #endif