mirror of
https://github.com/tcsenpai/hmacrypt.git
synced 2025-06-06 02:45:21 +00:00
Beginning of experiments - BUGS EVERYWHERE
This commit is contained in:
parent
8b2deee354
commit
c609ece773
29
large_file_encryptor.py
Normal file
29
large_file_encryptor.py
Normal file
@ -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 <filepath>")
|
||||||
|
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")
|
Loading…
x
Reference in New Issue
Block a user