Let say I've a fixed length number, e.g. 6 digit: 837493, I want to apply some process (with a salt), and generate a new number of another 6 digits,


number = 837493
another = hash(number + salt) // another is also a 6 digit number, e.g. 948375

Are there such algorithm exists?

  • Yep, any hash algorithm based on sponge construction – Spotted Oct 16 '15 at 8:06
  • 4
    What are you going to use this for? Is this for some kind of security application? If yes, then I highly discourage you making up your own hashing algorithm. – Euphoric Oct 16 '15 at 8:06
  • do leading zeros count? – ratchet freak Oct 16 '15 at 8:39
  • 1
    What security goals do you have? Hashing to 6 decimal digits is easy, but I have severe doubts that what you're trying to do is secure. Such a short hash can be neither collision nor pre-image resistant. – CodesInChaos Oct 16 '15 at 9:18
  • Forgive my ignorance, but when you say new number - you just mean any 6 digit number that isn't the input one - correct? – Robbie Dee Oct 16 '15 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.