MCPcopy Create free account
hub / github.com/LUX-Core/lux / FirstPut

Method FirstPut

src/cryptopp/default.cpp:96–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94
95template <class BC, class H, class Info>
96void DataEncryptor<BC,H,Info>::FirstPut(const byte *)
97{
98 SecByteBlock salt(DIGESTSIZE), keyCheck(DIGESTSIZE);
99 H hash;
100
101 // use hash(passphrase | time | clock) as salt
102 hash.Update(m_passphrase, m_passphrase.size());
103 time_t t=time(0);
104 hash.Update((byte *)&t, sizeof(t));
105 clock_t c=clock();
106 hash.Update((byte *)&c, sizeof(c));
107 hash.Final(salt);
108
109 // use hash(passphrase | salt) as key check
110 hash.Update(m_passphrase, m_passphrase.size());
111 hash.Update(salt, SALTLENGTH);
112 hash.Final(keyCheck);
113
114 AttachedTransformation()->Put(salt, SALTLENGTH);
115
116 // mash passphrase and salt together into key and IV
117 SecByteBlock key(KEYLENGTH);
118 SecByteBlock IV(BLOCKSIZE);
119 GenerateKeyIV<BC,H,Info>(m_passphrase, m_passphrase.size(), salt, SALTLENGTH, ITERATIONS, key, IV);
120
121 m_cipher.SetKeyWithIV(key, key.size(), IV);
122 SetFilter(new StreamTransformationFilter(m_cipher));
123
124 m_filter->Put(keyCheck, BLOCKSIZE);
125}
126
127template <class BC, class H, class Info>
128void DataEncryptor<BC,H,Info>::LastPut(const byte *inString, size_t length)

Callers

nothing calls this directly

Calls 5

AttachedTransformationFunction · 0.85
SetKeyWithIVMethod · 0.80
UpdateMethod · 0.45
sizeMethod · 0.45
PutMethod · 0.45

Tested by

no test coverage detected