1 // Crypto/Rar20Crypto.h
\r
3 #ifndef __CRYPTO_RAR20_CRYPTO_H
\r
4 #define __CRYPTO_RAR20_CRYPTO_H
\r
6 #include "Common/MyCom.h"
\r
8 #include "../ICoder.h"
\r
9 #include "../IPassword.h"
\r
16 Byte SubstTable[256];
\r
19 UInt32 SubstLong(UInt32 t)
\r
21 return (UInt32)SubstTable[(int)t & 255] |
\r
22 ((UInt32)SubstTable[(int)(t >> 8) & 255] << 8) |
\r
23 ((UInt32)SubstTable[(int)(t >> 16) & 255] << 16) |
\r
24 ((UInt32)SubstTable[(int)(t >> 24) & 255] << 24);
\r
26 void UpdateKeys(const Byte *data);
\r
27 void CryptBlock(Byte *buf, bool encrypt);
\r
29 void EncryptBlock(Byte *buf) { CryptBlock(buf, true); }
\r
30 void DecryptBlock(Byte *buf) { CryptBlock(buf, false); }
\r
31 void SetPassword(const Byte *password, UInt32 passwordLen);
\r
35 public ICompressFilter,
\r
36 public ICryptoSetPassword,
\r
37 public CMyUnknownImp
\r
41 MY_UNKNOWN_IMP1(ICryptoSetPassword)
\r
44 STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
\r
45 STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size);
\r