Mercurial > vba-clojure
view src/win32/7zip/7z/CPP/7zip/Crypto/ZipCrypto.h @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
line wrap: on
line source
1 // Crypto/ZipCrypto.h3 #ifndef __CRYPTO_ZIP_CRYPTO_H4 #define __CRYPTO_ZIP_CRYPTO_H6 #include "Common/MyCom.h"8 #include "../ICoder.h"9 #include "../IPassword.h"11 namespace NCrypto {12 namespace NZip {14 const unsigned kHeaderSize = 12;16 class CCipher17 {18 UInt32 Keys[3];20 void UpdateKeys(Byte b);21 Byte DecryptByteSpec();22 public:23 void SetPassword(const Byte *password, UInt32 passwordLen);24 Byte DecryptByte(Byte b);25 Byte EncryptByte(Byte b);26 void DecryptHeader(Byte *buf);27 void EncryptHeader(Byte *buf);28 };30 class CEncoder :31 public ICompressFilter,32 public ICryptoSetPassword,33 public ICryptoSetCRC,34 public CMyUnknownImp35 {36 CCipher _cipher;37 UInt32 _crc;38 public:39 MY_UNKNOWN_IMP2(40 ICryptoSetPassword,41 ICryptoSetCRC42 )43 STDMETHOD(Init)();44 STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);46 STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size);47 STDMETHOD(CryptoSetCRC)(UInt32 crc);48 HRESULT WriteHeader(ISequentialOutStream *outStream);49 };52 class CDecoder:53 public ICompressFilter,54 public ICryptoSetPassword,55 public CMyUnknownImp56 {57 CCipher _cipher;58 public:59 MY_UNKNOWN_IMP1(ICryptoSetPassword)61 STDMETHOD(Init)();62 STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);63 STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size);65 HRESULT ReadHeader(ISequentialInStream *inStream);66 };69 }}71 #endif