00001 #ifndef CRYPTOPP_WAKE_H
00002 #define CRYPTOPP_WAKE_H
00003
00004 #include "seckey.h"
00005 #include "secblock.h"
00006 #include "strciphr.h"
00007
00008 NAMESPACE_BEGIN(CryptoPP)
00009
00010
00011 template <class B = BigEndian>
00012 struct WAKE_OFB_Info : public FixedKeyLength<32>
00013 {
00014 static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "WAKE-OFB-LE" : "WAKE-OFB-BE";}
00015 };
00016
00017 class CRYPTOPP_NO_VTABLE WAKE_Base
00018 {
00019 protected:
00020 word32 M(word32 x, word32 y);
00021 void GenKey(word32 k0, word32 k1, word32 k2, word32 k3);
00022
00023 word32 t[257];
00024 word32 r3, r4, r5, r6;
00025 };
00026
00027 template <class B = BigEndian>
00028 class CRYPTOPP_NO_VTABLE WAKE_Policy : public AdditiveCipherConcretePolicy<word32, 1, 64>, protected WAKE_Base
00029 {
00030 protected:
00031 void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
00032
00033 void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
00034 bool CipherIsRandomAccess() const {return false;}
00035 };
00036
00037
00038 template <class B = BigEndian>
00039 struct WAKE_OFB : public WAKE_OFB_Info<B>, public SymmetricCipherDocumentation
00040 {
00041 typedef SymmetricCipherFinal<ConcretePolicyHolder<WAKE_Policy<B>, AdditiveCipherTemplate<> >, WAKE_OFB_Info<B> > Encryption;
00042 typedef Encryption Decryption;
00043 };
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 NAMESPACE_END
00062
00063 #endif