- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# seal.h

    00001 #ifndef CRYPTOPP_SEAL_H
    00002 #define CRYPTOPP_SEAL_H
    00003
    00004 #include "strciphr.h"
    00005
    00006 NAMESPACE_BEGIN(CryptoPP)
    00007
    00008 //! _
    00009 template <class B = BigEndian>
    00010 struct SEAL_Info : public FixedKeyLength<20, SimpleKeyingInterface::INTERNALLY_GENERATED_IV, 4>
    00011 {
    00012         static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "SEAL-3.0-LE" : "SEAL-3.0-BE";}
    00013 };
    00014
    00015 template <class B = BigEndian>
    00016 class CRYPTOPP_NO_VTABLE SEAL_Policy : public AdditiveCipherConcretePolicy<word32, 256>, public SEAL_Info<B>
    00017 {
    00018 protected:
    00019         void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length);
    00020         void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
    00021         void CipherResynchronize(byte *keystreamBuffer, const byte *IV);
    00022         bool IsRandomAccess() const {return true;}
    00023         void SeekToIteration(lword iterationCount);
    00024
    00025 private:
    00026         FixedSizeSecBlock<word32, 512> m_T;
    00027         FixedSizeSecBlock<word32, 256> m_S;
    00028         SecBlock<word32> m_R;
    00029
    00030         word32 m_startCount, m_iterationsPerCount;
    00031         word32 m_outsideCounter, m_insideCounter;
    00032 };
    00033
    00034 //! <a href="http://www.weidai.com/scan-mirror/cs.html#SEAL-3.0-BE">SEAL</a>
    00035 template <class B = BigEndian>
    00036 struct SEAL : public SEAL_Info<B>, public SymmetricCipherDocumentation
    00037 {
    00038         typedef SymmetricCipherFinal<ConcretePolicyHolder<SEAL_Policy<B>, AdditiveCipherTemplate<> >, SEAL_Info<B> > Encryption;
    00039         typedef Encryption Decryption;
    00040 };
    00041
    00042 NAMESPACE_END
    00043
    00044 #endif