Exemplo n.º 1
0
class MersenneTwisterCipher(StreamCipher):
    def __init__(self, key):
        StreamCipher.__init__(self)
        self.prng = MersenneTwister(seed=key)

    def _compute_key_bytes(self, byte_count):
        return self.prng.rand_bytes(byte_count)
Exemplo n.º 2
0
class MersenneTwisterCipher(StreamCipher):
    
    def __init__(self, key):
        StreamCipher.__init__(self)
        self.prng = MersenneTwister(seed=key)
        
    def _compute_key_bytes(self, byte_count):
        return self.prng.rand_bytes(byte_count)    
Exemplo n.º 3
0
 def value(self):
     prng = MersenneTwister(seed=self.SEED)
     return [prng.rand() for _ in range(self.INTS)]
     
Exemplo n.º 4
0
 def value(self):
     prng = MersenneTwister(seed=self.SEED)
     return [prng.rand() for _ in range(self.INTS)]
Exemplo n.º 5
0
 def _seed_generates_key_bytes(self, seed, key_bytes, prefix_size):
     byte_count = prefix_size + len(key_bytes)
     prng = MersenneTwister(seed)
     byte_string = prng.rand_bytes(byte_count)
     return byte_string[prefix_size:] == key_bytes
Exemplo n.º 6
0
 def __init__(self, key):
     StreamCipher.__init__(self)
     self.prng = MersenneTwister(seed=key)
Exemplo n.º 7
0
 def _get_output(self):
     return MersenneTwister(self.seed).rand()
Exemplo n.º 8
0
 def _seed_generates_output(self, integer, seed):
     prng = MersenneTwister(seed)
     return integer == prng.rand()
Exemplo n.º 9
0
 def _seed_generates_key_bytes(self, seed, key_bytes, prefix_size):
     byte_count = prefix_size + len(key_bytes)
     prng = MersenneTwister(seed)
     byte_string = prng.rand_bytes(byte_count)
     return byte_string[prefix_size:] == key_bytes
Exemplo n.º 10
0
 def __init__(self, key):
     StreamCipher.__init__(self)
     self.prng = MersenneTwister(seed=key)
Exemplo n.º 11
0
 def __init__(self):
     MatasanoChallenge.__init__(self)
     self.prng = MersenneTwister(seed=self.SEED)