0

I want to encrypt 2 numbers using a public key and have the reader know the correlation between those 2 numbers. I can also share the public key. Example:

22 => 785F3EC7EB32F30B90CD0FCF3657D388B5FF4297F2F9716FF66E9B69C05DDD09
95 => AD48FF99415B2F007DC35B7EB553FD1EB35EBFA2F2F308ACD9488EEB86F71FA8

AD48FF99415B2F007DC35B7EB553FD1EB35EBFA2F2F308ACD9488EEB86F71FA8 - 785F3EC7EB32F30B90CD0FCF3657D388B5FF4297F2F9716FF66E9B69C05DDD09 = 73

Is there any hashing or encryption algorithm that give me the chance to do something like that?

Would be ok also a one way hash.

Edit: I'll try to be clear here You have a table (list) of those hashes and you have to be able to calculate the difference without knowing the actual numbers. Also you have to be able to hash your number. It's made so that you never reveal your number but you can understand how big is your number compared to one on the list. So maybe a hashing function would be better than encrypt using keys.

Kastuto
  • 1
  • 1
  • 3
    I'm voting to close this question as off-topic because this is about [crypto](https://crypto.stackexchange.com) without involving programming. – Maarten Bodewes Jun 06 '18 at 22:46
  • crypto.stackexchange.com is definitely the right site for this. – Rob Napier Jun 06 '18 at 23:35
  • If you decide to post there: don't you mean that the result should be 73 instead of 22? – Maarten Bodewes Jun 07 '18 at 11:07
  • Yeah sorry but I was super tired when I wrote this. – Kastuto Jun 07 '18 at 11:19
  • 1
    You may want to look at "homomorphic encryption". There, you've got the term, good luck on your search. – Maarten Bodewes Jun 07 '18 at 13:21
  • There's going to be an issue insofar as "larger than" doesn't tend to have too much meaning in a finite field or ring. That said, what you're describing sounds like [Yao's Millionaire Problem](https://en.wikipedia.org/wiki/Yao%27s_Millionaires%27_Problem) so you might start there. – lockcmpxchg8b Jun 11 '18 at 00:03

0 Answers0