8 #include <botan/pgp_s2k.h>
16 const std::string& passphrase,
17 const byte salt_buf[],
size_t salt_size,
18 size_t iterations)
const
22 size_t pass = 0, generated = 0,
23 total_size = passphrase.
size() + salt_size;
24 size_t to_hash = std::max(iterations, total_size);
27 while(key_len > generated)
29 for(
size_t j = 0; j != pass; ++j)
32 size_t left = to_hash;
33 while(left >= total_size)
35 hash->
update(salt_buf, salt_size);
40 hash->
update(salt_buf, left);
43 hash->
update(salt_buf, salt_size);
45 hash->
update(reinterpret_cast<const byte*>(passphrase.data()), left);
48 hash_buf = hash->
final();
void update(const byte in[], size_t length)
OctetString derive_key(size_t output_len, const std::string &passphrase, const byte salt[], size_t salt_len, size_t iterations) const
virtual size_t output_length() const =0