Creating a unique URL safe hash

I want to hash/encode a unique integer (database ID) to create a similarly unique string.

It needs to meet the following requirements:

  1. Must start with a letter or number, and can contain only letters and numbers.
  2. All letters in a container name must be lowercase.
  3. Must be from 3 through 63 characters long (although the shorter the better)

The result does not need to be reversible, just repeatable - so a 1-way hash would be fine.


A simple solution would be a base 36 encoding. The output will be a string between one and six characters.

public static string EncodeBase36(int i)
  //Base conversion
  string s="";
    int digit = i % 36;
  // Enforce minimum length
    s = "0" + s;
  return s;

Need Your Help

Cocos2d-iphone basic compile error

iphone xcode cocos2d-iphone

I downloaded Cocos2d-iphone 0.99.5 and installed it using ./install-script

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.