Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose Alice wants to prove to Bob that t1 is less than t2. t1 and t2 represent timestamps. Alice does not want to reveal t1 and t2. However, she needs to receive Bob’s confirmation that t1 < t2. In order to prevent Bob from performing a brute-force attack to find t1 and t2, Alice wants to use some salt with the timestamps.

Any idea how to use cryptographic algorithms in order to solve this problem?

share|improve this question

migrated from Jun 9 '14 at 15:29

This question came from our site for professional and enthusiast programmers.

This seems to be a combination of a commitment and a zero knowledge proof. Your hashes solve the commitment part, but make the ZKP part impossible. There is a similar problem called Yao's Millionaires' Problem but there alice knowns one value and bob the other. You should search for "Zero knowledge proof" or perhaps "secure multi party computation". – CodesInChaos Jun 4 '14 at 10:42
Yes, ZKP makes it impossible but they are expensive in terms of operations. Having a simple and fast function, such as Order Preserving Hash can make it easier. It depends on to what extent we want to achieve privacy. – Mohammad Khodaei Jun 4 '14 at 15:31
up vote 1 down vote accepted

From the last part of your question, I understand that you need order preserving hash function or encryption. Look into this thread

share|improve this answer
This may be usable as fallback solution, but generally order preserving encryption leaks a bit much. If there is an efficient ZKP, it will be much stronger than OPE. – CodesInChaos Jun 4 '14 at 11:07
You are right, OPE is vulnerable to cryptanalysis however it can be useful when the time window for secrecy is preferentially smaller. In other words, if plaintext becomes useless after a short time (within which cryptanalysis will be impossible) then OPE can be used as a solution. – Syed Jun 4 '14 at 12:39

Use secure two-party computation, to prove that t1 < t2 holds. There's been a lot of recent work on schemes for secure two-party computation (e.g., using Yao-style garbled circuits), and they should easily be able to handle this.

You will need some way to prevent the parties from simply lying about their inputs. For instance, if you assume that Alice has previously published a commitment to t1 and Bob has published a commitment to t2, you can use secure two-party computation to simultaneously check whether their inputs are consistent with the commitment and their order.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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