I'm a biologist frantically trying to understand the world of cryptography overnight for research- please ignore my ignorance. I was given a large body of text to crack that is encrypted with AES-128 CBC with PKCS5 Padding. The key is MD5 PBKDF2 in HMAC-SHA1 and I'm given a 13-digit number in the form of "additional information". How do I go about obtaining the decryption key? Should I use the DK = PBKDF2(PRF, Password, Salt, c, dkLen) PBKDF2 derivation function on the body of text? I simply need the "password" or "decryption key" for use. I know- ignorance at its finest- please explain this to me like a child.

  • 2
    $\begingroup$ It sounds like you are in a rush, here's the answer without going into details: With the given information the only useful suggestion is: Try out what you can think of. There is no systematic way to make this any easier. At least with the information you've stated in the question. $\endgroup$
    – tylo
    Commented May 24, 2017 at 8:03
  • $\begingroup$ Adding to the above: your best bet is to try really fast what you think the person or device that chose the original password could have chosen. If you can make tries slowly using some program, you might want to automate trying, or better figure out what that program does and make automated tries with something faster. Programs like hashcat and hardware to run it at high speed exist for that purpose. $\endgroup$
    – fgrieu
    Commented May 24, 2017 at 10:52
  • $\begingroup$ You are about eight years old, these books are way too advanced for you. $\endgroup$
    – Maarten Bodewes
    Commented May 24, 2017 at 12:17

2 Answers 2


Well, there are a lot of different concepts in your question. As you've asked to, I'll consider you are ignorant of all of them, beside their names. I'll assume you are used to work with undergrad maths and terminology.

Let's begin:


You are dealing with encrypted data. To produce those, an encryption scheme has been used. An encryption scheme can be formally defined as being a tuple $(\mathcal{P,C,K,E,D})$ with a few properties:

  • $\mathcal{P}$ is a set called "the plaintext space". Its elements are called plaintexts.
  • $\mathcal{C}$ is a set called "the ciphertext space". Its elements are called ciphertexts.
  • $\mathcal{K}$ is a set called "the key space". Its elements are called keys.
  • $\mathcal{E}=\{E_k : k\in \mathcal{K}\}$ is a set of functions $E_k : \mathcal{P}\rightarrow\mathcal{C}$. Its elements are called "encryption functions".
  • $\mathcal{D}=\{D_k : k\in\mathcal{K}\}$ is a set of functions $D_k : \mathcal{C}\rightarrow\mathcal{P}$. Its elements are called "decryption functions".

Such that for each $e\in\mathcal{K}$, there exists $d\in\mathcal{K}$ such that $D_d(E_e(p)) = p$ for all $p\in\mathcal{P}$.

This means that for each key $e$ in the set of keys $\mathcal{K}$, there is a key $d$ also in the set of keys $\mathcal{K}$ such that the decryption function using $d$ as a key, called $D_d$, when applied to the encryption function using $e$ as a key called $E_e$ is the identity function, so that when both are applied in a succession, starting with $E_e$, to a plaintext $p$, one will recover the same plaintext $p$.

In your case, you are dealing with AES-128 CBC with PKCS5 padding, I'll explain what this means.

Block cipher

Now there is a whole family of encryption schemes called "block cipher". A block cipher is an encryption scheme whose sets $\mathcal{P}$ and $\mathcal{C}$ are the same and equal to all elements of a given, fixed, bit-size. That its functions $E_k$ and $D_k$ will take as input a block of size $n$ bits and a key of size $l$ bits and output a block of size $n$ bits.

Block cipher are symmetric, that is more or less, for all encryption-decryption key pairs $(e,d)\in\mathcal{K}\times\mathcal{K}$, we have that $e=d$, i.e., we can encrypt a plaintext and decrypt the corresponding ciphertext with the same key.

In your case, the block cipher is AES-128, it has a block of 128 bits.

Mode of operation

Since a block cipher can only deal with blocks, in order to encrypt arbitrary data, we will use them in conjunction with a mode of operation. The mode of operations allows to split the plain data into multiple blocks, encrypts them with the block cipher and chain them together into the enciphered data.

There are multiple modes of operations with different advantages and drawbacks, but in your case the mode of operation is CBC.


There are multiple reasons to use padding, but in the CBC case, you'll mainly want to use padding so that you are sure to have a quantity of bits in your plaintext that is a multiple of the block-size of your block cipher.

Now, all those things have been standardized a lot and you're dealing with one specific padding type, the PKCS5 padding.

Now, regarding the key, you are mentioning the following: "The key is MD5 PBKDF2 in HmacSHA1", so let me explain what those are.

Key derivation function

PBKDF2 is a key derivation function, relying on a given PRF (HMAC-SHA1 in your case) to derive a password out of another password, in order to protect the former against brute-force attacks and dictionary attacks, etc. (More information can be found here for example.)

Key derivation function take generally at least two inputs: a password to process and a salt to ensure it won't produce the same value if the same password is entered with two different salt. (Thus avoiding dictionary attacks.)

PBKDF2 also takes as input a number of iteration, which will determine the "difficulty" of brute-forcing it.

Why I can't help you

Now, the problem is that we don't have enough data to be of any help. You mention at least two things I'm not sure what to do with:

  • MD5 is an hash function and I don't see why someone who has already used PBKDF2 to derive a password would then hash it with MD5, since it's not useful... But as you're formulating it I'd say that you should hash the result of PBKDF2 with MD5 to get the key.
  • Additional info, you've got a 13 digits number, but what is that? This is too big a number to be the number of iterations applied in the PBKDF2 function, so it could be the initial password which you should process with PBKDF2 (and possibly then with MD5), but then you're lacking both the salt and the number of PBKDF2 iterations to be able to do it...
  • It is not clear to me what data you are given exactly? I've assumed you possess the ciphertext, but are lacking the key. Because if you've got the ciphertext and the key, then you simply need to apply AES-128-CBC with PKCS5 padding decryption to it and voila. If you are given the code used to generate it, it is also not the same as if you are only given the above information, because in the code we could find the salt and number of PBKDF2 iterations, maybe.

frantically trying to understand the world of cryptography overnight

This limits your options dramatically. First: read Lery's answer, and the comments under your original post. Then: realize that you are careening headlong into Kerckhoff's principle, which for your purposes means

Even if you know by what methods the data was encrypted, the data cannot be decrypted without the secret key.

You are better off using your limited time discussing ways to get useful data with other scientists (that is, assuming you're trying to access scientific data...).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.