-1

I want to use cryptographic function that returns the initial input or something related to it like its hash, the function should work like Encrypting some data, then Encrypt the output of the data, and encrypt it again another time, and the loop continue to specific number of iterations and finally it can produce the first input after iterating it.

assuming that we can use any different keys or same key if required in encryption and the function can only go in one way it can't be reversible so i can't run this process from the back loop and finally it should return the first input or something related to its first input by checking the hash of it or something like that.

thanks for help

  • 1
    XOR (one-time pad) encryption will return your input if applied any even number of times. With the same key, of course. – Eugene Sh. Jul 21 '22 at 17:16
  • @Eungene Sh. but i don't want to be reversible it can only pass in one way i can't go in the other direction – Mohamed A. Taha Jul 21 '22 at 17:49
  • 2
    But this is what you asked for no? If you can apply the same function certain number of times and retrieve the first input, then it is reversible. – Eugene Sh. Jul 21 '22 at 17:50
  • @Eungene Sh. sorry i just mean by reversible it can only go from data1 to data2 to data3 an so on.. until datax then data1 again, i don't want it to be go also from back like data1 to datax to data(x-1) an so on until data2 to data1 again do you understand me? – Mohamed A. Taha Jul 21 '22 at 17:56

1 Answers1

1

rsa has this property if you only look at the encryption...

this is because of how rsa works:

n = p * q

e * d = 1 mod phi(n)

x = (x^e)^d = x^(e * d) mod n

if you are calculating mod n, all exponents are mod phi(n), hence d is the multiplicative inverse of e (fermat's little theorem)

since that's a cyclic group and e and d are choosen to generate that group, there's your cyclic property

if phi(n) is secret, calculating d from e is seemingly a hard problem (that's what makes it hard to break RSA)

to reverse the cycle you need the inverse exponent.

but here's the catch: you won't have control over the size of the cycle, and by trying to create small cycles, you will end up with weak keys that can potentially be bruteforced to get the inverse element which will break the one way property

and speaking about cycle sizes... with sufficiently sized rsa keys the cycle sizes are probably too large for you... like not-within-your-lifetime large... phi(n) ... with phi being eulers phi function ... n being p * q ... and p and q being primes with like 1200 digits

DarkSquirrel42
  • 10,167
  • 3
  • 20
  • 31