RC4Encryption (version 0.0.2)
index
rc4encryption.py

This file implements RC4 cipher.
 
>>> from urllib.request import urlopen, Request
>>> from json import dumps, load
>>> rc4 = RC4Encryption(b'key')
>>> rc4.make_key()
>>> cipher = rc4.encrypt(b'secrets')
>>> cipher.hex() == load(urlopen(Request("https://www.lddgo.net/api/RC4?lang=en", headers={"Content-Type": "application/json;charset=UTF-8"}, data=dumps({"inputContent":"secrets","inputPassword":"key","charset":"UTF-8","inputFormat":"string","outputFormat":"hex","encrypt":True}).encode())))["data"]
True
>>> cipher_continuation = rc4.encrypt(b'secrets')
>>> assert cipher_continuation != cipher
>>> rc4.reset(b'key')
>>> rc4.make_key()
>>> rc4.encrypt(cipher)
b'secrets'
>>> rc4.encrypt(cipher_continuation)
b'secrets'
>>> 
 
~# python3 RC4Encryption.py -s mydata mykey -1
3B1FE10F0025
~# python3 RC4Encryption.py -s 3B1FE10F0025 -n base16 mykey
mydata
~# python3 RC4Encryption.py -i secrets.file -6 -o cipher.b64 key
~# python3 RC4Encryption.py -o decipher.file -n base64 -i cipher.b64 key
 
1 items passed all tests:
  12 tests in RC4
12 tests in 14 items.
12 passed and 0 failed.
Test passed.

 
Classes
       
builtins.object
RC4Encryption

 
class RC4Encryption(builtins.object)
    RC4Encryption(key: bytes)
 
This class implements RC4 cipher.
 
  Methods defined here:
__init__(self, key: bytes)
Initialize self.  See help(type(self)) for accurate signature.
encrypt(self, secret: bytes) -> bytes
This function encrypts secret using RC4.
make_key(self) -> None
This function builds the key.
reset(self, key: bytes) -> None
This function resets key and other variables.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Data
        __all__ = ['RC4Encryption']
__author_email__ = 'mauricelambert434@gmail.com'
__copyright__ = '\nRC4Encryption Copyright (C) 2021, 2024 Mauric...ome to redistribute it\nunder certain conditions.\n'
__description__ = 'This package implements RC4 encryption.'
__license__ = 'GPL-3.0 License'
__maintainer__ = 'Maurice Lambert'
__maintainer_email__ = 'mauricelambert434@gmail.com'
__url__ = 'https://github.com/mauricelambert/RC4Encryption'

 
Author
        Maurice Lambert