File indexing completed on 2025-01-18 09:55:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef CRYPTOPP_SKIPJACK_H
0014 #define CRYPTOPP_SKIPJACK_H
0015
0016 #include "seckey.h"
0017 #include "secblock.h"
0018
0019 NAMESPACE_BEGIN(CryptoPP)
0020
0021
0022 struct SKIPJACK_Info : public FixedBlockSize<8>, public FixedKeyLength<10>
0023 {
0024 CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return "SKIPJACK";}
0025 };
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 class SKIPJACK : public SKIPJACK_Info, public BlockCipherDocumentation
0036 {
0037
0038 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SKIPJACK_Info>
0039 {
0040 public:
0041 void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms);
0042 unsigned int OptimalDataAlignment() const {return GetAlignmentOf<word16>();}
0043
0044 protected:
0045 static const byte fTable[256];
0046
0047 FixedSizeSecBlock<byte, 10*256> tab;
0048 };
0049
0050
0051 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Enc : public Base
0052 {
0053 public:
0054 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
0055 private:
0056 static const byte Se[256];
0057 static const word32 Te[4][256];
0058 };
0059
0060
0061 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Dec : public Base
0062 {
0063 public:
0064 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
0065 private:
0066 static const byte Sd[256];
0067 static const word32 Td[4][256];
0068 };
0069
0070 public:
0071 typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
0072 typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
0073 };
0074
0075 typedef SKIPJACK::Encryption SKIPJACKEncryption;
0076 typedef SKIPJACK::Decryption SKIPJACKDecryption;
0077
0078 NAMESPACE_END
0079
0080 #endif