- import socket
- def main():
- # Server configuration
- host = '127.0.0.1'
- port = 12345
- # Create a socket object
- server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- # Bind the socket to the address
- server_socket.bind((host, port))
- # Listen for incoming connections
- server_socket.listen(1)
- print("Server is listening on port", port)
- # Accept a connection
- client_socket, addr = server_socket.accept()
- print("Connection from", addr)
- # Receive data from the client
- data = client_socket.recv(1024).decode()
- print("Received data from server:", data)
- # Split received data into individual values
- values = data.split(',')
- # Display received values
- print("Received values from server:")
- print("p:", values[0])
- print("q:", values[1])
- print("g:", values[2])
- print("k:", values[3])
- print("hm:", values[4])
- print("x:", values[5])
- print("y:", values[6])
- print("s:", values[8])
- print("\n")
- print("Verification:")
- print("w:", values[9])
- print("u1:", values[10])
- print("u2:", values[11])
- print("v:", values[12])
- print("\n")
- print("r' (from sender):", values[7])
- print("v (calculated):", values[12])
- # Perform DSS verification
- r = int(values[7])
- v = int(values[12])
- if v == r:
- print("Digital Signature Standard (DSS) verification Successful")
- else:
- print("Digital Signature Standard (DSS) Verification Failed")
- # Close the connection
- client_socket.close()
- if __name__ == "__main__":
- main()
[text] cccccccccccccccc
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new: