aboutsummaryrefslogtreecommitdiffstats
path: root/docs/development
diff options
context:
space:
mode:
authorEhren Kret <ehren.kret@gmail.com>2015-11-28 02:48:24 -0800
committerEhren Kret <ehren.kret@gmail.com>2015-11-28 02:48:24 -0800
commit48f180173e947c128b625b9264f66720060e4585 (patch)
treed61d5a1275992eb45868d51f99dc920001a43a27 /docs/development
parente23c0b7db86e85b8b037a67d1ce75f67153e4cc0 (diff)
downloadcryptography-48f180173e947c128b625b9264f66720060e4585.tar.gz
cryptography-48f180173e947c128b625b9264f66720060e4585.tar.bz2
cryptography-48f180173e947c128b625b9264f66720060e4585.zip
Fix pep8 lint errors
Diffstat (limited to 'docs/development')
-rw-r--r--docs/development/custom-vectors/arc4/generate_arc4.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/docs/development/custom-vectors/arc4/generate_arc4.py b/docs/development/custom-vectors/arc4/generate_arc4.py
index 093bb49d..3dee44a3 100644
--- a/docs/development/custom-vectors/arc4/generate_arc4.py
+++ b/docs/development/custom-vectors/arc4/generate_arc4.py
@@ -12,8 +12,10 @@ from cryptography.hazmat.primitives.ciphers import algorithms
_RFC6229_KEY_MATERIALS = [
- (True, 8*'0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20'),
- (False, 8*'1ada31d5cf688221c109163908ebe51debb46227c6cc8b37641910833222772a')
+ (True,
+ 8 * '0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20'),
+ (False,
+ 8 * '1ada31d5cf688221c109163908ebe51debb46227c6cc8b37641910833222772a')
]
@@ -47,25 +49,30 @@ _SIZES_TO_GENERATE = [
def _key_for_size(size, keyinfo):
msb, key = keyinfo
if msb:
- return key[:size//4]
+ return key[:size // 4]
else:
- return key[-size//4:]
+ return key[-size // 4:]
def _build_vectors():
count = 0
output = []
key = None
- plaintext = binascii.unhexlify(32*'0')
+ plaintext = binascii.unhexlify(32 * '0')
for size in _SIZES_TO_GENERATE:
for keyinfo in _RFC6229_KEY_MATERIALS:
key = _key_for_size(size, keyinfo)
- cipher = ciphers.Cipher(algorithms.ARC4(binascii.unhexlify(key)), None, default_backend())
+ cipher = ciphers.Cipher(
+ algorithms.ARC4(binascii.unhexlify(key)),
+ None,
+ default_backend())
encryptor = cipher.encryptor()
current_offset = 0
for offset in _RFC6229_OFFSETS:
if offset % 16 != 0:
- raise ValueError("Offset {} is not evenly divisible by 16".format(offset))
+ raise ValueError(
+ "Offset {} is not evenly divisible by 16"
+ .format(offset))
while current_offset < offset:
encryptor.update(plaintext)
current_offset += len(plaintext)
@@ -73,8 +80,10 @@ def _build_vectors():
count += 1
output.append("KEY = {}".format(key))
output.append("OFFSET = {}".format(offset))
- output.append("PLAINTEXT = {}".format(binascii.hexlify(plaintext)))
- output.append("CIPHERTEXT = {}".format(binascii.hexlify(encryptor.update(plaintext))))
+ output.append("PLAINTEXT = {}".format(
+ binascii.hexlify(plaintext)))
+ output.append("CIPHERTEXT = {}".format(
+ binascii.hexlify(encryptor.update(plaintext))))
current_offset += len(plaintext)
assert not encryptor.finalize()
return "\n".join(output)