File indexing completed on 2025-01-18 09:55:09
0001
0002
0003
0004
0005
0006
0007 #ifndef CRYPTOPP_SHARK_H
0008 #define CRYPTOPP_SHARK_H
0009
0010 #include "config.h"
0011 #include "seckey.h"
0012 #include "secblock.h"
0013
0014 NAMESPACE_BEGIN(CryptoPP)
0015
0016
0017
0018 struct SHARK_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public VariableRounds<6, 2>
0019 {
0020 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "SHARK-E";}
0021 };
0022
0023
0024
0025
0026 class SHARK : public SHARK_Info, public BlockCipherDocumentation
0027 {
0028
0029
0030 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SHARK_Info>
0031 {
0032 public:
0033 void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶m);
0034
0035 protected:
0036 unsigned int m_rounds;
0037 SecBlock<word64> m_roundKeys;
0038 };
0039
0040
0041
0042 class CRYPTOPP_NO_VTABLE Enc : public Base
0043 {
0044 public:
0045 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
0046
0047
0048 void InitForKeySetup();
0049
0050 private:
0051 static const byte sbox[256];
0052 static const word64 cbox[8][256];
0053 };
0054
0055
0056
0057 class CRYPTOPP_NO_VTABLE Dec : public Base
0058 {
0059 public:
0060 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
0061
0062 private:
0063 static const byte sbox[256];
0064 static const word64 cbox[8][256];
0065 };
0066
0067 public:
0068 typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
0069 typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
0070 };
0071
0072 typedef SHARK::Encryption SHARKEncryption;
0073 typedef SHARK::Decryption SHARKDecryption;
0074
0075 NAMESPACE_END
0076
0077 #endif