Add files via upload
Remove redundant code
This commit is contained in:
1
main.cpp
1
main.cpp
@@ -45,7 +45,6 @@ int main() {//g++ AES.cpp main.cpp -o program
|
||||
getline(cin, tmp);
|
||||
for (int i = 0; i < 16; i++) { key[i] = tmp[i]; }
|
||||
|
||||
cout << "textLength " << textLength << '\n';
|
||||
unsigned char *ciphertext = new unsigned char [textLength];
|
||||
encryptECB(textLength,plaintext, key, ciphertext);
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include"pkcs7_HPP.hpp"
|
||||
using namespace std;
|
||||
void pkcs7_padding(string& str, int BlockSize) {
|
||||
cout << BlockSize << ' ' << str.size() << '\n';
|
||||
int PaddingSize = BlockSize - (str.size() % BlockSize);
|
||||
unsigned char PaddingChar = (unsigned char)PaddingSize;
|
||||
for (int i = 0; i < PaddingSize; i++) {
|
||||
@@ -12,9 +11,7 @@ void pkcs7_padding(string& str, int BlockSize) {
|
||||
}
|
||||
|
||||
void pkcs7_unpadding(string& str) {
|
||||
cout << "ttttt " << (unsigned char)str[str.size() - 1] << '\n';
|
||||
int PaddingSize = (int)((unsigned char)str[str.size() - 1]);
|
||||
cout << "paddingsize " << PaddingSize << '\n';
|
||||
str.resize(str.size() - PaddingSize);
|
||||
return;
|
||||
}
|
||||
Reference in New Issue
Block a user