View difference between Paste ID: Wj5HQUkJ and U7Tr0HXm
SHOW: | | - or go back to the newest paste.
1
import hmac
2
import hashlib
3
 
4
 
5
def first_two(server_seed, client_seed, nonce):
6
    server_seed = server_seed.encode('utf-8')
7
    msg = '%s:%d' % (client_seed, nonce)
8
    h = hmac.new(server_seed, msg.encode('utf-8'), hashlib.sha512)
9
    return int(h.hexdigest()[:2], 16)
10
 
11
server_seed = 'abcde'
12
user_seed = '12345'
13
nonce = 1
14
rounds = 1000000
15
 
16
output = open('out.txt', 'w')
17-
for i in xrange(rounds):
17+
for i in range(rounds):
18
     output.write('%d\n' % first_two(server_seed, user_seed, nonce))
19
     nonce += 1