From c609ece7735e97936c28f2913fc13eef323a6d3a Mon Sep 17 00:00:00 2001 From: tcsenpai Date: Thu, 8 Feb 2024 18:55:45 +0100 Subject: [PATCH] Beginning of experiments - BUGS EVERYWHERE --- large_file_encryptor.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 large_file_encryptor.py diff --git a/large_file_encryptor.py b/large_file_encryptor.py new file mode 100644 index 0000000..4534e89 --- /dev/null +++ b/large_file_encryptor.py @@ -0,0 +1,29 @@ +#!/bin/python + +import src.hmacrypt as hmacrypt +import sys +import os +import bysp + +# Getting and requiring exactly 1 argument +if len(sys.argv) != 2: + print("Usage: python3 file_encryptor.py ") + sys.exit(1) +filepath = sys.argv[1] + +# The file should exist and be readable +if not os.path.isfile(filepath): + print("File not found") + sys.exit(1) + +# Getting file size +size = os.path.getsize(filepath) +print("File size: " + str(size) + " bytes") +# REVIEW Dividing the file into 1MB chunks +chunks = size // 1048576 +print("Chunks: " + str(chunks)) +bysp.split_file(filepath, chunks) +exit(0) + +hmacrypt.self_encrypt_file(filepath, filepath + ".enc") +print("Encrypted file: " + filepath + ".enc") \ No newline at end of file