Mercurial > vba-linux
view src/win32/7zip/7z/CPP/7zip/Crypto/Rar20Crypto.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/Rar20Crypto.h3 #ifndef __CRYPTO_RAR20_CRYPTO_H4 #define __CRYPTO_RAR20_CRYPTO_H6 #include "Common/MyCom.h"8 #include "../ICoder.h"9 #include "../IPassword.h"11 namespace NCrypto {12 namespace NRar20 {14 class CData15 {16 Byte SubstTable[256];17 UInt32 Keys[4];19 UInt32 SubstLong(UInt32 t)20 {21 return (UInt32)SubstTable[(int)t & 255] |22 ((UInt32)SubstTable[(int)(t >> 8) & 255] << 8) |23 ((UInt32)SubstTable[(int)(t >> 16) & 255] << 16) |24 ((UInt32)SubstTable[(int)(t >> 24) & 255] << 24);25 }26 void UpdateKeys(const Byte *data);27 void CryptBlock(Byte *buf, bool encrypt);28 public:29 void EncryptBlock(Byte *buf) { CryptBlock(buf, true); }30 void DecryptBlock(Byte *buf) { CryptBlock(buf, false); }31 void SetPassword(const Byte *password, UInt32 passwordLen);32 };34 class CDecoder:35 public ICompressFilter,36 public ICryptoSetPassword,37 public CMyUnknownImp38 {39 CData _cipher;40 public:41 MY_UNKNOWN_IMP1(ICryptoSetPassword)43 STDMETHOD(Init)();44 STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);45 STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size);46 };48 }}50 #endif