mirror of
https://github.com/avinal/Krypto.git
synced 2026-01-09 06:38:35 +05:30
add file decrypt and encryt driver code
Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
This commit is contained in:
@@ -25,5 +25,3 @@ file(GLOB KRYPTO_INC ${PROJECT_SOURCE_DIR}/include/*.h)
|
||||
add_executable(${PROJECT_NAME} ${KRYPTO_SRC} ${KRYPTO_INC})
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE blowfish/include PUBLIC include)
|
||||
target_link_libraries(${PROJECT_NAME} blowfish)
|
||||
|
||||
|
||||
|
||||
13
src/Main.cpp
13
src/Main.cpp
@@ -21,9 +21,14 @@ int main(int argc, char const *argv[]) {
|
||||
test.pad_input(buffer, stat.filesize);
|
||||
|
||||
krypto::Encryptor encryptor;
|
||||
// encryptor.blowfish_encrypt(buffer, password, stat.filesize);
|
||||
encryptor.blowfish_decrypt(buffer,password,stat.filesize);
|
||||
test.write_file(filename.substr(8) , buffer, stat.filesize);
|
||||
|
||||
int pos;
|
||||
if ((pos = filename.find("krypto")) != std::string::npos) {
|
||||
encryptor.blowfish_decrypt(buffer, password, stat.filesize);
|
||||
test.write_file(filename.substr(0, pos-1), buffer, stat.filesize);
|
||||
} else {
|
||||
encryptor.blowfish_encrypt(buffer, password, stat.filesize);
|
||||
test.write_file(filename + ".krypto", buffer, stat.filesize);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user