Encrypt data @data with key @key, skipping @skip first bytes of the keystream
(key, data, skip=0)
| 18 | |
| 19 | |
| 20 | def ARC4_encrypt(key, data, skip=0): |
| 21 | """Encrypt data @data with key @key, skipping @skip first bytes of the |
| 22 | keystream""" |
| 23 | |
| 24 | algorithm = algorithms.ARC4(key) |
| 25 | cipher = Cipher(algorithm, mode=None, backend=default_backend()) |
| 26 | encryptor = cipher.encryptor() |
| 27 | if skip: |
| 28 | encryptor.update(b"\x00" * skip) |
| 29 | return encryptor.update(data) |
| 30 | |
| 31 | |
| 32 | def ARC4_decrypt(key, data, skip=0): |
no test coverage detected
searching dependent graphs…