MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / CryptData

Class CryptData

Libraries/unrar/crypt.hpp:23–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21
22
23class CryptData
24{
25 struct KDF5CacheItem
26 {
27 SecPassword Pwd;
28 byte Salt[SIZE_SALT50];
29 byte Key[32];
30 uint Lg2Count; // Log2 of PBKDF2 repetition count.
31 byte PswCheckValue[SHA256_DIGEST_SIZE];
32 byte HashKeyValue[SHA256_DIGEST_SIZE];
33 };
34
35 struct KDF3CacheItem
36 {
37 SecPassword Pwd;
38 byte Salt[SIZE_SALT30];
39 byte Key[16];
40 byte Init[16];
41 bool SaltPresent;
42 };
43
44
45 private:
46 void SetKey13(const char *Password);
47 void Decrypt13(byte *Data,size_t Count);
48
49 void SetKey15(const char *Password);
50 void Crypt15(byte *Data,size_t Count);
51
52 void SetKey20(const char *Password);
53 void Swap20(byte *Ch1,byte *Ch2);
54 void UpdKeys20(byte *Buf);
55 void EncryptBlock20(byte *Buf);
56 void DecryptBlock20(byte *Buf);
57
58 void SetKey30(bool Encrypt,SecPassword *Password,const wchar *PwdW,const byte *Salt);
59 void SetKey50(bool Encrypt,SecPassword *Password,const wchar *PwdW,const byte *Salt,const byte *InitV,uint Lg2Cnt,byte *HashKey,byte *PswCheck);
60
61 KDF3CacheItem KDF3Cache[4];
62 uint KDF3CachePos;
63
64 KDF5CacheItem KDF5Cache[4];
65 uint KDF5CachePos;
66
67 CRYPT_METHOD Method;
68
69 Rijndael rin;
70
71 uint CRCTab[256]; // For RAR 1.5 and RAR 2.0 encryption.
72
73 byte SubstTable20[256];
74 uint Key20[4];
75
76 byte Key13[3];
77 ushort Key15[4];
78 public:
79 CryptData();
80 ~CryptData();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected