Score:1

Stuck on Decrypting with RSA and SHA256 in Encryption Task

kn flag

I'm working on solving a encryption task, and I'm a bit stuck. I want to clarify that I'm only seeking hints and not direct answers since I want to solve it myself. The goal is to solve it on my own; otherwise, it wouldn't make sense. Therefore, I'm just looking for hints to help me progress from where I'm stuck or any comments suggesting that I might be missing an aspect or something.

The task started with an image that had text in the background. From the information in the background of the image, I managed to obtain N, e, d, p, and q related to RSA encryption. There are also two formulas for a variable called "key." One formula is based on d and N, which I have. The other formula is a condition that should be satisfied, and my results reveal that it is satisfied.

There is also a given hint about a value of c, which is c = d7a7e396df976cf6c59adce5d1381ea020a35af126efd0d5d380e4ccb74758e0f05e86a0bed61ac75d5a1dfd029c8792ced99c5abf33354505e288f0b9bda280c9099506be3c3ee818b5e405e1fbf45903708cd067cafa34aa5f5b88958ae6603b4a427ab2.

Additionally, it is mentioned that m = decrypt(sha256("%d" % key), c), and this is where I'm primarily stuck. I'm coding in Python, and that's where I've made the most progress so far. I've coded two separate programs: one that encrypts text using the public key and another program that decrypts the text using the calculated private key. It works, and I can encrypt and decrypt text with the values I have. I'm just stuck regarding m = decrypt(sha256("%d" % key), c). Maybe there are some steps I'm overlooking or missing information?

I hope someone can provide a comment or hint on what considerations I should make.

fgrieu avatar
ng flag
Is $c/N$ in range $[0.0001, 0.9999]$ making it plausible that $c$ is encrypted per RSA with $N$ the public modulus? Especially if so, my bets are that `m = decrypt(h, c)` means one of $m=c^h\bmod N$ or $c=m^h\bmod N$ ; and that `sha256("%d" % key)` is the string with the decimal representation of integer `key`, converted to bytestring, hashed per SHA-256, with the resulting hash then converted to the integer $h$ (likely per big-endian binary convention). Notice that if the right interpretation is $c=m^h\bmod N$, then $h$ is a public encryption exponent, not directly usable for decryption.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.