print(tan(int.from_bytes(open("plain.txt", "rb").read().strip(), "big")).n(1024))

Its sage code. How difficult or easy is it to recover the plaintext from the output of this code? I don't think the hash collision, or second preimage attack will be usefully unless we know the length of the plaintext.

Is there any possible way to recover the plaintext efficiently or is there no other way?

  • $\begingroup$ Why don't you think hash collision isn't useful? The point of cryptographic hash functions is that the output of the hash function isn't related to the output of a similar input, otherwise you can converge on the output. $\endgroup$
    – Maarten Bodewes
    Commented Jul 22, 2023 at 14:29
  • $\begingroup$ I meant not efficient. It will be difficult finding a hash collision. I am Looking for something like a weakness or bad implementation that will allow us to find the plain text in reasonable time like 1 or 2 mins max for a high end normal pc. I wanted to know if something like finding the preimage is possible from the output. If i know the plain text starts with hello and ends with world. then is it possible to find using any method or attack? $\endgroup$ Commented Jul 22, 2023 at 15:01
  • $\begingroup$ You can converge in milliseconds, if that. I assume you got that due to the deletion... It is no problem leaving your question or to self answer. $\endgroup$
    – Maarten Bodewes
    Commented Jul 22, 2023 at 15:52
  • $\begingroup$ yeah i realised how dumb i was to ask that and deleted it. Thank you @MaartenBodewes $\endgroup$ Commented Sep 21, 2023 at 19:02


Your Answer

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

Browse other questions tagged or ask your own question.