Encryption 密码反馈模式c++;实施

Encryption 密码反馈模式c++;实施,encryption,block-cipher,Encryption,Block Cipher,嗨,我很累,无法用DES实现CFB。我想我可以用CFB加密,但我怎样才能解密??我的主要问题是使用CFB正确加密的CFB代码??。由于受到限制,我无法使用其他图书馆 for (int i = 0; i < VecMSG.size(); i++) { DESEncrypt(IV, Key); stringstream str; str << bitset < 32 > (V[0]); //First 32 bits convert to string str <

嗨,我很累,无法用DES实现CFB。我想我可以用CFB加密,但我怎样才能解密??我的主要问题是使用CFB正确加密的CFB代码??。由于受到限制,我无法使用其他图书馆

for (int i = 0; i < VecMSG.size(); i++) {
DESEncrypt(IV, Key);

stringstream str;
str << bitset < 32 > (V[0]); //First 32 bits convert to string
str << bitset < 32 > (V[1]); //Second 32 bits covert to string and join with the first
VText2 = VText = str.str(); //Store in 2 different strings
VText = VText.substr(0, 5); //Take the most significant first 5 bits in the form of 
str.str("");

bitset < 2 > mybits(VText); //covert to bits
bitset < 2 > mybits2(VecMSG[i]); //covert plaintext bits from string to bits
str << (mybits ^= mybits2); //XOR with and convert to string
VecCipher.push_back(str.str()); //Store in a different vector
str.str("");
VText2 = VText2.substr(5) + VecCipher[i]; //Remove the first 5 bits and join ciphertext to the end
V[0] = (unsigned int)VText2.substr(0,32).c_str();
V[1] = (unsigned int)VText2.substr(32).c_str();
for(int i=0;imybits(VText);//转换为位
位集<2>mybits2(vecmg[i]);//将明文位从字符串转换为位
str