Created
July 27, 2015 16:03
-
-
Save jstedfast/24205f9cc043633d1957 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
namespace Blah { | |
public class Program | |
{ | |
public static void Main (string[] args) | |
{ | |
const string base36 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
ulong value = ulong.MaxValue; | |
var id = string.Empty; | |
value = (ulong) args[0].GetHashCode (); | |
do { | |
id = base36[(int) (value % 36)] + id; | |
value /= 36; | |
} while (value != 0); | |
if (id.Length < 13) | |
id = new string ('0', 13 - id.Length) + id; | |
Console.WriteLine ("id = {0}", id); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment