# Generate redirect
return HttpResponseRedirect("%s?i=%s&d=%s" % (
site.redirecturl,
- base64.b64encode(iv, "-_"),
- base64.b64encode(cipher, "-_"),
+ base64.b64encode(iv, b"-_").decode('ascii'),
+ base64.b64encode(cipher, b"-_").decode('ascii'),
))
# Base64-encode the response, just to be consistent
return "%s&%s" % (
- base64.b64encode(iv, '-_'),
- base64.b64encode(cipher, '-_'),
+ base64.b64encode(iv, b'-_').decode('ascii'),
+ base64.b64encode(cipher, b'-_').decode('ascii'),
)
# the first block more random..
# Since this is a fake authentication, put it 5 minutes into the future to
# give more time to copy/paste it.
- s = "t=%s&%s" % (int(time.time() + 300), urllib.urlencode(info))
+ s = "t=%s&%s" % (int(time.time() + 300), urllib.parse.urlencode(info))
r = Random.new()
iv = r.read(16)
encryptor = AES.new(base64.b64decode(options.key), AES.MODE_CBC, iv)
cipher = encryptor.encrypt(s + ' ' * (16 - (len(s) % 16)))
- print "Paste the following after the receiving url:"
- print "?i=%s&d=%s" % (
- base64.b64encode(iv, "-_"),
- base64.b64encode(cipher, "-_"),
- )
+ print("Paste the following after the receiving url:")
+ print("?i=%s&d=%s" % (
+ base64.b64encode(iv, b"-_").decode('ascii'),
+ base64.b64encode(cipher, b"-_").decode('ascii'),
+ ))