Security Scol plugin
cast.h
Go to the documentation of this file.
1// cast.h - originally written and placed in the public domain by Wei Dai
2
6
7#ifndef CRYPTOPP_CAST_H
8#define CRYPTOPP_CAST_H
9
10#include "seckey.h"
11#include "secblock.h"
12
13NAMESPACE_BEGIN(CryptoPP)
14
15
17class CAST
18{
19protected:
20 static const word32 S[8][256];
21};
22
25struct CAST128_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 5, 16>
26{
27 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "CAST-128";}
28};
29
34{
36 class CRYPTOPP_NO_VTABLE Base : public CAST, public BlockCipherImpl<CAST128_Info>
37 {
38 public:
39 void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
40
41 protected:
42 bool reduced;
45 };
46
48 class CRYPTOPP_NO_VTABLE Enc : public Base
49 {
50 public:
51 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
52 };
53
55 class CRYPTOPP_NO_VTABLE Dec : public Base
56 {
57 public:
58 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
59 };
60
61public:
64};
65
68struct CAST256_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 4>
69{
70 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "CAST-256";}
71};
72
77{
79 class CRYPTOPP_NO_VTABLE Base : public CAST, public BlockCipherImpl<CAST256_Info>
80 {
81 public:
82 void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
83 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
84
85 protected:
86 static const word32 t_m[8][24];
87 static const unsigned int t_r[8][24];
88
89 static void Omega(int i, word32 kappa[8]);
90
92 mutable FixedSizeSecBlock<word32, 8> kappa;
94 };
95
96public:
99};
100
103
106
107NAMESPACE_END
108
109#endif
Provides class member functions to key a block cipher.
Definition seckey.h:318
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition seckey.h:306
CAST128 block cipher.
Definition cast.h:34
CAST256 block cipher.
Definition cast.h:77
CAST block cipher base.
Definition cast.h:18
Inherited by algorithms with fixed block size.
Definition seckey.h:41
Fixed size stack-based SecBlock.
Definition secblock.h:1246
Interface for retrieving values given their names.
Definition cryptlib.h:322
Inherited by keyed algorithms with variable key length.
Definition seckey.h:166
unsigned int word32
32-bit unsigned datatype
Definition config_int.h:62
Classes and functions for secure memory allocations.
Classes and functions for implementing secret key algorithms.
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher.
Definition seckey.h:399
CAST128 block cipher information.
Definition cast.h:26
CAST256 block cipher information.
Definition cast.h:69