gpt4 book ai didi

algorithm - 什么是s2k算法?

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:40:30 24 4
gpt4 key购买 nike

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);

最佳答案

String-to-key (S2K) specifiers are used to convert passphrase strings into symmetric-key encryption/decryption keys. They are used in two places, currently: to encrypt the secret part of private keys in the private keyring, and to convert passphrases to encryption keys for symmetrically encrypted messages.

来源(包含更多详细信息):http://sunsite.icm.edu.pl/gnupg/rfc2440-3.html

关于algorithm - 什么是s2k算法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2845476/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com