Skip to content

Commit

Permalink
Update client.py
Browse files Browse the repository at this point in the history
  • Loading branch information
amri-tah authored Dec 26, 2023
1 parent e95ff28 commit 17a9de1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions code/client-side/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ def merkle_tree(chunks):
mid = len(chunks) // 2
left_hash = merkle_tree(chunks[:mid])
right_hash = merkle_tree(chunks[mid:])
print(f"Left Chunk:{chunks[:mid]}, Left Hash: {left_hash}\nRight Chunk:{chunks[mid:]}, Right Hash: {right_hash}\n")

return sha256(left_hash.encode() + right_hash.encode()).hexdigest()

def show_files(ip):
IP = socket.gethostbyname(socket.gethostname()) # change the value to ip while connecting to server on another system
IP = socket.gethostbyname(socket.gethostname())
# change the value to input ip while connecting to server on another system
# IP = ip
ADDR = (IP, PORT)

try:
Expand Down Expand Up @@ -82,7 +83,9 @@ def show_files(ip):

# Function to upload a file to the server
def upload_file(filename, ip):
IP = socket.gethostbyname(socket.gethostname()) # change the value to ip while connecting to server on another system
IP = socket.gethostbyname(socket.gethostname())
# change the value to input ip while connecting to server on another system
# IP = ip
ADDR = (IP, PORT)

try:
Expand Down Expand Up @@ -140,7 +143,9 @@ def upload_file(filename, ip):

# Function to download a file from the server
def download_file(filename, ip):
IP = socket.gethostbyname(socket.gethostname()) # change the value to ip while connecting to server on another system
IP = socket.gethostbyname(socket.gethostname())
# change the value to input ip while connecting to server on another system
# IP = ip
ADDR = (IP, PORT)

try:
Expand Down

0 comments on commit 17a9de1

Please sign in to comment.