s2k 算法的定义是什么?例如,“PBKDF2(SHA-1)”是一种 s2k 算法。
下面是一些引用 s2k 的 Botan 代码:
AutoSeeded_RNG rng;
std::auto_ptr<S2K> s2k(get_s2k("PBKDF2(SHA-1)"));
s2k->set_iterations(8192);
s2k->new_random_salt(rng, 8);
SymmetricKey bc_key = s2k->derive_key(key_len, "BLK" + passphrase);
InitializationVector iv = s2k->derive_key(iv_len, "IVL" + passphrase);
SymmetricKey mac_key = s2k->derive_key(16, "MAC" + passphrase);