是否可以暴力破解标准 XOR 密码?
知道这个:
*#(I@KI
用异或函数编码
//
std::string CStringCoding::Xor( const std::string& strIn )
{
std::string sOut = "";
for(std::size_t loop = 0; loop < strIn.size(); loop++)
{
unsigned int iCharacter = static_cast<unsigned int>(strIn[loop] ^ sKey[loop % sKey.size()]);
sOut += iCharacter;
}
return sOut;
}
我可以使用经典的单词表方法来暴力破解吗?
我在想:
Generate a Wordlist KEY
XOR the *#(I@KI with a KEY to DECIPHER it and obtain a STRING
XOR the STRING with a KEY to CIPHER it
Compare newly CIPHERED STRING with the INPUT CIPHERED STRING
If they match, the KEY has been found
我没有测试它,只是在我采取行动和花太多时间做一些行不通的事情之前询问一下。
谢谢。
最佳答案
假设您正在加密有意义的人类可读文本,则有可能破解此 XOR cipher如果攻击者将拥有:
- 使用 key 重用编码的密文(例如循环 % sKey.size() )
- 2个用相同 key 编码的密文
Frequency analysis可以打破这两种情况。
但是用与消息长度相同的真正随 secret 钥对明文进行异或处理是可以的。这将是牢不可破的密码:One-Time Pad
OTP is immune even to brute-force attacks.Trying all keys simply yields all plaintexts, all equally likely to be the actual plaintext
关于c++ - 暴力异或密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17693514/