diff --git a/PATH b/PATH new file mode 100644 index 0000000..2566589 --- /dev/null +++ b/PATH @@ -0,0 +1 @@ +/home/Vadzik/Data/Maxim/University/ВКР/disk_eraser/venv/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin diff --git a/app/utils_drive.py b/app/utils_drive.py index 22effda..510a030 100644 --- a/app/utils_drive.py +++ b/app/utils_drive.py @@ -1,8 +1,9 @@ import threading import os +import pygost.gost3412 as gost -from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes -from cryptography.hazmat.backends import default_backend +# from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes +# from cryptography.hazmat.backends import default_backend erasing_methods = { "2 прохода": { @@ -31,12 +32,17 @@ erasing_methods = { def get_random_bytes(size): seed=os.urandom(32) - backend = default_backend() - cipher = Cipher(algorithms.AES(seed), modes.CTR(b'\0'*16), backend=backend) - encryptor = cipher.encryptor() + # backend = default_backend() + # cipher = Cipher(algorithms.AES(seed), modes.CTR(b'\0'*16), backend=backend) + # encryptor = cipher.encryptor() nulls=b'\0'*(size) - return encryptor.update(nulls) + enc = gost.GOST3412Kuznechik(seed) + rounds = int(size / 32) + data = b'' + for i in range(512): + data += enc.encrypt(nulls) + return data class Drive(): @@ -84,7 +90,7 @@ class Drive(): else: data = erasing_methods[method]["data"][i] * write_size drive.write(data) - len_write += write_size + len_write += len(data) cur_percent = len_write/self.capacity if cur_percent - prev_percent > 0.01: progressbar.set(cur_percent) diff --git a/pygost-5.13/dist/pygost-5.13-py3.12.egg b/pygost-5.13/dist/pygost-5.13-py3.12.egg index 3ae678c..8609e5b 100644 Binary files a/pygost-5.13/dist/pygost-5.13-py3.12.egg and b/pygost-5.13/dist/pygost-5.13-py3.12.egg differ