A
A
Alexander2018-05-19 14:26:40
Python
Alexander, 2018-05-19 14:26:40

How to make correct arguments for decrypt function (Pycrypto/Blowfish)?

Hi everyone! There are encrypted cookies, the reception is not encrypted in python. But you need to decrypt them in python. For example, here is the cookie: wjhH1qBTHoD4oM4vkI9UzNaj3K2kCkXV%2BupPfs1hLrU%3D The
key and vector are saved in redis and look like this:
key: l\x1CF\x06\xAC\x00U\xD2v\xBEiQ\xD7\xE7\x0D_\xFA|\xFE_\ xD9\x11\xE9\x13\x83\xF3\x87\x86\[email protected]\x84
vector: \xF6a\xD9[w\xCA\[email protected]
Python code:

encrypted = "wjhH1qBTHoD4oM4vkI9UzNaj3K2kCkXV%2BupPfs1hLrU%3D"
  key = "l\x1CF\x06\xAC\x00U\xD2v\xBEiQ\xD7\xE7\x0D_\xFA|\xFE_\xD9\x11\xE9\x13\x83\xF3\x87\x86\[email protected]\x84"
  iv = " \xF6a\xD9[w\xCA\[email protected]"
  cipher = Blowfish.new(key, Blowfish.MODE_CBC, iv)
  bs = Blowfish.block_size
  encrypted = encrypted[bs:]
  print(cipher.decrypt(encrypted))

And the question is: how to convert the input strings so that decrypt() can gobble them up without any problems?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question