0

I've been reading a lot about how to generate a unique id, using hash, sha, md5, and things like that.

I need to generate a unique id for a unique url using two parameters, so I can't use an md5 hash, or sha because those are way too long, and the url will be really big.

I like the way youtube identifies each video, anybody knows how this can be done? anything to read?

Thanks!

Andres
  • 11,439
  • 12
  • 48
  • 87
  • what is the type of the two parameters? what is the range (if params are numbers) – knightrider Sep 05 '12 at 21:12
  • possible duplicate of [How to code a URL shortener?](http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener) – Karl Bielefeldt Sep 05 '12 at 21:17
  • You don't tell us what your requirements are. Is uniqueness all you need? What is the nature of your parameters? Could you just concatenate them? Digests like MD5, SHA-family, etc., also provide protection against reversing. – yotommy Sep 05 '12 at 21:17

1 Answers1

1

I think you should read this thread How to code a URL shortener? it answer your question exactly

Community
  • 1
  • 1
MichaelT
  • 7,574
  • 8
  • 34
  • 47