Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show a GUID in 36 letters format

Tags:

c#

.net

guid

base64

GUID is big random number show in a HEX basis. I want to show this number in a shorter format, lets say that based on the all letters and numbers. That is a 36 basis.

Lets say that: 2f1e4fc0-81fd-11da-9156-00036a0f876a will become as 3jEl9x6eZi.

Is there any 'ready' algorithm for this in .Net?

it need to be bidirectional.

Edit: using Base64 is even better solution. The only problem is Base64 contains / char which is not compatible to use in URI.

like image 599
Fitzchak Yitzchaki Avatar asked Feb 14 '10 00:02

Fitzchak Yitzchaki


2 Answers

I think the closest that you will find is Base36 however it won't work with a GIUD type (only an Int16, Int32, or Int64).

like image 126
Kane Avatar answered Nov 15 '22 12:11

Kane


Maybe this is what you need: ShortGuid - A shorter and url friendly GUID class in C#

like image 20
Carlos Gutiérrez Avatar answered Nov 15 '22 13:11

Carlos Gutiérrez