blob: 734555fe29e9a7ff0058c91da1cf49de9a79f6a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
diff --git a/lib/Crypto/Protocol/AllOrNothing.py b/lib/Crypto/Protocol/AllOrNothing.py
index f2d70bc..6167cf5 100644
--- a/lib/Crypto/Protocol/AllOrNothing.py
+++ b/lib/Crypto/Protocol/AllOrNothing.py
@@ -190,13 +190,14 @@ class AllOrNothing:
# encrypted, and create the hash cipher.
K0 = self.__K0digit * self.__key_size
hcipher = self.__newcipher(K0)
+ block_size = self.__ciphermodule.block_size
# Since we have all the blocks (or this method would have been called
# prematurely), we can calcualte all the hash blocks.
hashes = []
for i in range(1, len(blocks)):
mticki = blocks[i-1] ^ i
- hi = hcipher.encrypt(long_to_bytes(mticki))
+ hi = hcipher.encrypt(long_to_bytes(mticki, block_size))
hashes.append(bytes_to_long(hi))
# now we can calculate K' (key). remember the last block contains
@@ -204,8 +205,7 @@ class AllOrNothing:
key = blocks[-1] ^ reduce(operator.xor, hashes)
# and now we can create the cipher object
- mcipher = self.__newcipher(long_to_bytes(key))
- block_size = self.__ciphermodule.block_size
+ mcipher = self.__newcipher(long_to_bytes(key, self.__key_size))
# And we can now decode the original message blocks
parts = []
|