Mercurial > vba-linux
comparison 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 |
comparison
equal
deleted
inserted
replaced
0:8ced16adf2e1 | 1:f9f4f1b99eed |
---|---|
1 // Crypto/ZipCrypto.h | |
2 | |
3 #ifndef __CRYPTO_ZIP_CRYPTO_H | |
4 #define __CRYPTO_ZIP_CRYPTO_H | |
5 | |
6 #include "Common/MyCom.h" | |
7 | |
8 #include "../ICoder.h" | |
9 #include "../IPassword.h" | |
10 | |
11 namespace NCrypto { | |
12 namespace NZip { | |
13 | |
14 const unsigned kHeaderSize = 12; | |
15 | |
16 class CCipher | |
17 { | |
18 UInt32 Keys[3]; | |
19 | |
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 }; | |
29 | |
30 class CEncoder : | |
31 public ICompressFilter, | |
32 public ICryptoSetPassword, | |
33 public ICryptoSetCRC, | |
34 public CMyUnknownImp | |
35 { | |
36 CCipher _cipher; | |
37 UInt32 _crc; | |
38 public: | |
39 MY_UNKNOWN_IMP2( | |
40 ICryptoSetPassword, | |
41 ICryptoSetCRC | |
42 ) | |
43 STDMETHOD(Init)(); | |
44 STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size); | |
45 | |
46 STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size); | |
47 STDMETHOD(CryptoSetCRC)(UInt32 crc); | |
48 HRESULT WriteHeader(ISequentialOutStream *outStream); | |
49 }; | |
50 | |
51 | |
52 class CDecoder: | |
53 public ICompressFilter, | |
54 public ICryptoSetPassword, | |
55 public CMyUnknownImp | |
56 { | |
57 CCipher _cipher; | |
58 public: | |
59 MY_UNKNOWN_IMP1(ICryptoSetPassword) | |
60 | |
61 STDMETHOD(Init)(); | |
62 STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size); | |
63 STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size); | |
64 | |
65 HRESULT ReadHeader(ISequentialInStream *inStream); | |
66 }; | |
67 | |
68 | |
69 }} | |
70 | |
71 #endif |