+/Cryptopals

git clone https://git.julia.blue/+/Cryptopals

Joseph RyanAdd rust solutions6d42c13

master
358 B17 linesraw
1import binascii
2
3b2hex = lambda b: binascii.hexlify(b)
4
5fixedXor = lambda a, b: bytes([a[i] ^ b[i] for i in range(len(a))])
6
7
8def repeatingXor(s, k):
9    while len(k) < len(s):
10        k += k
11    return b2hex(fixedXor(s, k))
12
13
14data = b"Burning 'em, if you ain't quick and nimble\nI go crazy when I hear a cymbal"
15key = b"ICE"
16
17print(repeatingXor(data, key))