mirror of
https://github.com/avinal/Krypto.git
synced 2026-01-09 22:58:36 +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})
|
add_executable(${PROJECT_NAME} ${KRYPTO_SRC} ${KRYPTO_INC})
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE blowfish/include PUBLIC include)
|
target_include_directories(${PROJECT_NAME} PRIVATE blowfish/include PUBLIC include)
|
||||||
target_link_libraries(${PROJECT_NAME} blowfish)
|
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);
|
test.pad_input(buffer, stat.filesize);
|
||||||
|
|
||||||
krypto::Encryptor encryptor;
|
krypto::Encryptor encryptor;
|
||||||
// encryptor.blowfish_encrypt(buffer, password, stat.filesize);
|
int pos;
|
||||||
encryptor.blowfish_decrypt(buffer,password,stat.filesize);
|
if ((pos = filename.find("krypto")) != std::string::npos) {
|
||||||
test.write_file(filename.substr(8) , buffer, stat.filesize);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user