aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pypride.py2
-rwxr-xr-xtest-vectors.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/pypride.py b/pypride.py
index b30b565..c011f74 100644
--- a/pypride.py
+++ b/pypride.py
@@ -239,7 +239,7 @@ def matrixMultiply(matrix, input):
input as Int
Output: Int"""
- mult = [ mapXor([c * ((input >> (15 - c_i)) & 0x1) for c_i, c in reversed(list(enumerate(r)))]) for r in matrix ]
+ mult = [ mapXor([1 for c_i, c in enumerate(r) if c == 1 and input & (0x1 << (15 - c_i))]) for r in matrix ]
return sum([(1 << (15-i)) * v for i,v in enumerate(mult)])
def roundKey(key, i):
diff --git a/test-vectors.py b/test-vectors.py
index 2cd75f5..065bb76 100755
--- a/test-vectors.py
+++ b/test-vectors.py
@@ -54,5 +54,5 @@ for vector in test_vectors:
print encryption == vector['ciphertext'].decode('hex'), decryption == vector['plaintext'].decode('hex')
print "Generating round keys:", str(time_cipher) + "s"
-print "Encryption:", str(time_encrypt) + "s"
-print "Decryption:", str(time_decrypt) + "s" \ No newline at end of file
+print "Encryption: ", str(time_encrypt) + "s"
+print "Decryption: ", str(time_decrypt) + "s" \ No newline at end of file