0

How can I know that how much shorturl hashes could be generated by my little app in base62?

So, if I write like this;

$len = 4;
$url = "http://stackoverflow.com/";
// base62
$chrs = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$hash = generateShortURL($len, $url, $chrs);

I tried pow() but I think that's was wrong, 'cos results are so less than I guess.

for ($i = 4; $i <= 6; $i++) {
  echo "62 ^ $i = ". thousandFormat(pow(62, $i)) ."\n";
}

Results;

62 ^ 4 = 14.776.336
62 ^ 5 = 916.132.832
62 ^ 6 = 56.800.235.584
Kerem
  • 11,377
  • 5
  • 59
  • 58
  • Why do you think it is wrong? Why do you think the numbers should be greater (they are not). – Howard Jul 14 '11 at 18:37
  • @qeremy: I don't understand your question. It looks like you already have the answer in it. – hakre Jul 14 '11 at 18:39
  • @hakre; if results are true, then Tinyurl will be closed soon (it's open since 2002), so Goo.le too. 'Cos Goo.le started giving 3 hash len about 1.5 year ago, but now it gives 5 chars, and tomorrow? Anyway, I'm curious about how much hash I can generate. Thank you. – Kerem Jul 14 '11 at 18:59
  • @qeremy: Sick of short Urls? http://hugeurl.geeks.org/ – hakre Jul 14 '11 at 19:03

1 Answers1

1

The method you're using is the correct one. 62 ^ 4 will give you the number of hashes 4 characters will give you, and so on.

Dan Smith
  • 5,685
  • 32
  • 33