Comparing two values without revealing them
From the last part of your question, I understand that you need order preserving hash function or encryption. Look into this thread
How does order-preserving encryption work?