1 from openid import cryptutil
2 from openid import oidutil
3
5 if len(x) != len(y):
6 raise ValueError('Inputs to strxor must have the same length')
7
8 xor = lambda (a, b): chr(ord(a) ^ ord(b))
9 return "".join(map(xor, zip(x, y)))
10
12 DEFAULT_MOD = 155172898181473697471232257763715539915724801966915404479707795314057629378541917580651227423698188993727816152646631438561595825688188889951272158842675419950341258706556549803580104870537681476726513255747040765857479291291572334510643245094715007229621094194349783925984760375594985848253359305585439638443L
13
14 DEFAULT_GEN = 2
15
18
19 fromDefaults = classmethod(fromDefaults)
20
22 self.modulus = long(modulus)
23 self.generator = long(generator)
24
25 self._setPrivate(cryptutil.randrange(1, modulus - 1))
26
28 """This is here to make testing easier"""
29 self.private = private
30 self.public = pow(self.generator, self.private, self.modulus)
31
35
37 return pow(composite, self.private, self.modulus)
38
39 - def xorSecret(self, composite, secret, hash_func):
43