- Статус
- Оффлайн
- Регистрация
- 18 Мар 2019
- Сообщения
- 816
- Реакции
- 64
1:
function decrypt($str, $cipher_key, $iv_key)
{
$method = 'aes-256-cfb';
$decrypted = openssl_decrypt(base64_decode($str), $method, $cipher_key, OPENSSL_RAW_DATA, $iv_key);
return $decrypted;
}
1:
std::string encrypt(std::string str, std::string cipher_key, std::string iv_key)
{
std::string str_out;
CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption encryption((BYTE*)cipher_key.c_str(), cipher_key.length(), (BYTE*)iv_key.c_str());
CryptoPP::StringSource encryptor(str, true,
new CryptoPP::StreamTransformationFilter(encryption,
new CryptoPP::Base64Encoder(
new CryptoPP::StringSink(str_out),
false
)
)
);
return str_out;
}
Шифрую слово test с ключами "thJMv4fVJsC6d4tJ", "5HBllSQJzQfk6KNn" получаю в C++ jfJXFA==.
Разшифровываю в php за место test получаю Ec� - кто сможет помочь решить проблему?