Skip to content

Commit

Permalink
small clean up of commands and unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
SirGankalot committed Jul 17, 2024
1 parent c6ee047 commit 4a5add8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
9 changes: 0 additions & 9 deletions service/src/call_c.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
import subprocess

#done in dockerfile
def compile_c_program():
result = subprocess.run(["gcc", "-o", "src/key_gen", "src/key_gen.c", "-lgmp"], capture_output=True, text=True)
if result.returncode == 0:
print("Compilation successful.")
else:
print(f"Compilation failed:\n{result.stderr}")
exit(1)

def run_c_program():
command = "./src/key_gen"
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Expand Down
6 changes: 0 additions & 6 deletions service/src/rsa_encryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
#from gmpy2 import is_prime
from . import call_c

# the prime calculation is based on https://www.geeksforgeeks.org/how-to-generate-large-prime-numbers-for-rsa-algorithm/
# First 10000 prime numbers


first_primes_list = list(sympy.primerange(2, 10000))

Expand All @@ -29,8 +26,6 @@ def get_keys():


async def encryption_of_message(message, public_key):
#make 52 byte/char long messages and add them together to make bigger
#byte_len = 20
byte_len = 52
public_key = rsa.PublicKey.load_pkcs1(public_key.encode())
message = message.encode('utf-8')
Expand All @@ -42,7 +37,6 @@ async def encryption_of_message(message, public_key):
return base64.b64encode(cipher_string).decode()

def decryption_of_message(cipher_string, private_key):
#byte_len = 32 #64
byte_len = 64
private_key = rsa.PrivateKey.load_pkcs1(private_key.encode())
cipher_string = base64.b64decode(cipher_string)
Expand Down

0 comments on commit 4a5add8

Please sign in to comment.