Mercurial > vba-linux
diff 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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/win32/7zip/7z/CPP/7zip/Crypto/ZipCrypto.h Sat Mar 03 10:31:27 2012 -0600 1.3 @@ -0,0 +1,71 @@ 1.4 +// Crypto/ZipCrypto.h 1.5 + 1.6 +#ifndef __CRYPTO_ZIP_CRYPTO_H 1.7 +#define __CRYPTO_ZIP_CRYPTO_H 1.8 + 1.9 +#include "Common/MyCom.h" 1.10 + 1.11 +#include "../ICoder.h" 1.12 +#include "../IPassword.h" 1.13 + 1.14 +namespace NCrypto { 1.15 +namespace NZip { 1.16 + 1.17 +const unsigned kHeaderSize = 12; 1.18 + 1.19 +class CCipher 1.20 +{ 1.21 + UInt32 Keys[3]; 1.22 + 1.23 + void UpdateKeys(Byte b); 1.24 + Byte DecryptByteSpec(); 1.25 +public: 1.26 + void SetPassword(const Byte *password, UInt32 passwordLen); 1.27 + Byte DecryptByte(Byte b); 1.28 + Byte EncryptByte(Byte b); 1.29 + void DecryptHeader(Byte *buf); 1.30 + void EncryptHeader(Byte *buf); 1.31 +}; 1.32 + 1.33 +class CEncoder : 1.34 + public ICompressFilter, 1.35 + public ICryptoSetPassword, 1.36 + public ICryptoSetCRC, 1.37 + public CMyUnknownImp 1.38 +{ 1.39 + CCipher _cipher; 1.40 + UInt32 _crc; 1.41 +public: 1.42 + MY_UNKNOWN_IMP2( 1.43 + ICryptoSetPassword, 1.44 + ICryptoSetCRC 1.45 + ) 1.46 + STDMETHOD(Init)(); 1.47 + STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size); 1.48 + 1.49 + STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size); 1.50 + STDMETHOD(CryptoSetCRC)(UInt32 crc); 1.51 + HRESULT WriteHeader(ISequentialOutStream *outStream); 1.52 +}; 1.53 + 1.54 + 1.55 +class CDecoder: 1.56 + public ICompressFilter, 1.57 + public ICryptoSetPassword, 1.58 + public CMyUnknownImp 1.59 +{ 1.60 + CCipher _cipher; 1.61 +public: 1.62 + MY_UNKNOWN_IMP1(ICryptoSetPassword) 1.63 + 1.64 + STDMETHOD(Init)(); 1.65 + STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size); 1.66 + STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size); 1.67 + 1.68 + HRESULT ReadHeader(ISequentialInStream *inStream); 1.69 +}; 1.70 + 1.71 + 1.72 +}} 1.73 + 1.74 +#endif