Simple XOR Encryptor
Project description
Encrypting library for python
This library provides a socket encryption method based on XOR and Diffie-Hellman algorithm
Examples
Using the Encrypt method
import encrypting
pair = encrypting.generate_pair() # Used for 2 sides
alice = encrypting.Encrypt(pair)
bob = encrypting.Encrypt(pair)
alice.init(bob.mixture) # Initializing encryption
bob.init(alice.mixture)
e = alice.crypt(b'Your bytes')
d = bob.crypt(e) # The function for encryption and decryption is the same
print(d) # Printing b'Your bytes'
Using the EncryptedSocket
Server (multithread):
import encrypting
def handler(sock, addr): # sock: EncryptedSocket class
print('Connected:', addr)
data = sock.recv(1024) # Receiving an encrypted message and decrypting it
sock.send(data) # Encrypting a message and sending it
return
bind_addr = ('127.0.0.1', 1234)
sock = encrypting.EncryptedSocket()
sock.serve(bind_addr, handler) # Starting the server (goes into an infinite loop waiting for connections)
Client:
import encrypting
connect_addr = ('127.0.0.1', 1234)
sock = encrypting.EncryptedSocket()
server = sock.connect(connect_addr) # Connect to the server and create a secure connection
while True:
message = input('Message > ').encode()
server.send(message)
data = server.recv(1024).decode()
print('Server:', data)
EncryptedClient object
- Creating an object:
EncryptedClient(socket, Encrypt)
Methods:
EncryptedClient(socket, Encrypt).send(bytes)- sending bytes to the serverEncryptedClient(socket, Encrypt).recv(n_bytes)- recieving bytes from the serverEncryptedClient(socket, Encrypt).close()- close the connection
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file encrypting-0.2-py3-none-any.whl.
File metadata
- Download URL: encrypting-0.2-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5a23c66b02e18edd09ab6ac7acb91fb59594d1c077ed3474e76f625b9620021
|
|
| MD5 |
70367c694a4b7acfb85d88e04c404fa4
|
|
| BLAKE2b-256 |
37fd2efd46b79e2efde8ef0e94150d6af7bd6f6fe9af8b4715ac52e734f7c5f9
|