summaryrefslogtreecommitdiff
blob: bac45c68b18be964c7d27116e199a54ab9ae9d0b (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
--- src/bundle/AfSplitter.py.~1~	2017-07-15 10:25:21.503324481 +0200
+++ src/bundle/AfSplitter.py	2017-07-15 10:26:39.589273253 +0200
@@ -43,13 +43,7 @@
 # will need changed to use Crypto.Random (now in python-crypt git)
 # see: http://lists.dlitz.net/pipermail/pycrypto/2008q3/000020.html
 from Crypto import Random
-from Crypto.Cipher import XOR
-
-def _xor(a, b):
-	"""Internal function to performs XOR on two strings a and b"""
-
-	xor = XOR.new(a)
-	return xor.encrypt(b)
+from Crypto import Util
 
 def _diffuse(block, size, digest):
 	"""Internal function to diffuse information inside a buffer"""
@@ -91,11 +85,11 @@
 		# Get some random data
 		r = rand.rand(blockSize)
 		ret += r
-		bufblock = _xor(r, bufblock)
+		bufblock = strxor(r, bufblock)
 		bufblock = _diffuse(bufblock, blockSize, digesttype)
 		rand.add_event(bufblock)
 
-	ret += _xor(bufblock, data)
+	ret += strxor(bufblock, data)
 	return ret
 
 def AFMerge(data, stripes, digesttype='sha1'):
@@ -108,7 +102,7 @@
 
 	bufblock = "\x00" * blockSize
 	for i in range(0, stripes - 1):
-		bufblock = _xor(data[i*blockSize:(i+1)*blockSize], bufblock)
+		bufblock = strxor(data[i*blockSize:(i+1)*blockSize], bufblock)
 		bufblock = _diffuse(bufblock, blockSize, digesttype)
 
-	return _xor(data[(stripes-1)*blockSize:], bufblock)
+	return strxor(data[(stripes-1)*blockSize:], bufblock)
--- src/bundle/PBKDFv2.py.~1~	2012-05-26 14:19:34.000000000 +0200
+++ src/bundle/PBKDFv2.py	2017-07-15 10:31:27.009731785 +0200
@@ -32,7 +32,7 @@
 """
 
 import struct, string, math, hashlib, hmac # RFC2104
-from Crypto.Cipher import XOR
+from Crypto import Util
 
 ################ PBKDFv2
 class PBKDFv2:
@@ -145,5 +145,4 @@
         if len(a) != len(b):
             raise ValueError("ERROR: Strings are of different size! %s %s" % (len(a), len(b)))
 
-	xor = XOR.new(a)
-	return xor.encrypt(b)
+	return strxor(a, b)