T
T
Tayrus02021-11-16 02:59:09
Cryptography
Tayrus0, 2021-11-16 02:59:09

How to deal with this cipher?

here is the text itself that needs to be decrypted Lbc5OJkdOZyqri8OF89kBA%3D%3D

An example of what should happen after decrypting from 9MaGC081K1jLXeMyHUCwWg%3D%3D
to 0862352228, from OrBlChFU%2F7WYSJG54o5gJg%3D%3Dto0831446070

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim Grishin, 2021-11-16
@Tayrus0

Total:
Cipher - 3DES/CBC padding mode = PKCS5, key="F9nA5uH8CeWreBraCRukaChe" IV="pUJeQ3Tr"

>>> import pyDes
>>> import base64
>>> data = base64.b64decode("9MaGC081K1jLXeMyHUCwWg==")
>>> f = "pUJeQ3Tr".encode('ascii')
>>> b = "F9nA5uH8CeWreBraCRukaChe".encode('ascii')
>>> k=pyDes.triple_des(b,pyDes.CBC,f,pad=None,padmode=pyDes.PAD_PKCS5)
>>> print(k.decrypt(data))
b'0862352228'

Those. seems to be working.
Examination:
>>> data2 = base64.b64decode("Lbc5OJkdOZyqri8OF89kBA==")
>>> print(k.decrypt(data2))
b'0874271626'

H
hint000, 2021-11-16
@hint000

Lbc5OJkdOZyqri8OF89kBA%3D%3D
is Lbc5OJkdOZyqri8OF89kBA==

$ echo Lbc5OJkdOZyqri8OF89kBA== | base64 -d
-�98�9���/�d
Okay, so then
$ echo Lbc5OJkdOZyqri8OF89kBA== | base64 -d | hexdump -C
00000000  2d b7 39 38 99 1d 39 9c  aa ae 2f 0e 17 cf 64 04  |-.98..9.../...d.|
00000010

What you will do with it, I don't know.

V
Vindicar, 2021-11-16
@Vindicar

Well, as far as I can see, you are only interested in two pieces of code.
Initialization (abbreviated):

this.d = Cipher.getInstance("DESede/CBC/PKCS5Padding");
this.e = new SecretKeySpec(this.b, "DESede");
this.f = "pUJeQ3Tr".getBytes();
this.g = new IvParameterSpec(this.f);
this.d.init(2, this.e, this.g);

Decryption:
str2 = new String(this.d.doFinal(Base64.decode(URLDecoder.decode(str, "UTF-8"), 0)), "UTF-8");

If we remove BASE64 and url-encoding (needed to shove a binary sequence into a web page), we get just a call to this.d.doFinal().
Cipher.getInstance("DESede/CBC/PKCS5Padding") is an explicit reference to the library class, so you find out what class is used, where it comes from, look for docks, look for valid cipher codes.
When you understand what the "DESede / CBC / PKCS5Padding" cipher is, you can start looking for analogues in Python.
Also look for where the secret key this.b comes from in the initialization.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question