Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Create URL Safe and Cryptographically Strong Short GUID
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Text; using System.Security.Cryptography; namespace Rextester { public class Program { public static void Main(string[] args) { byte[] bytes = new byte[16]; using (var provider = System.Security.Cryptography.RandomNumberGenerator.Create()) { provider.GetBytes(bytes); } var guid = new Guid(bytes); Console.WriteLine(guid); var shortGuid = guid.ToShortString(); Console.WriteLine(shortGuid); } } public static class GuidHelper { public static string ToShortString(this Guid guid) { return Convert.ToBase64String(guid.ToByteArray()) .Substring(0, 22) .Replace("/", "_") .Replace("+", "-"); } } }
run
|
edit
|
history
|
help
0
Kumaran-RegText-CityStatePostalCode Parsing
gh
Finally statement called after return
uniqueness 2.8
bubble sort
PrimeiroProjeto
Task 1_4
my first
Collection_ Introduction default constructor rule_accessing methods from object returned from property
Before Number big