Barry, Thanks for the reply. I'm trying now to do the reverse but am a little stuck. I've tried the following but it's not getting back to the Guid I originally started out with.
Encoding enc = Encoding.ASCII; string myString1 = enc.GetString(Convert.FromBase64String(encoded)); Is this what you had in mind? Thanks, Shawn Hevel, API, AIT Lead Programmer Analyst Information Technology Department South Carolina Farm Bureau Insurance Companies Phone: (803) 936-4331 Fax: (803) 936-4629 Work Email: [EMAIL PROTECTED] Home Email: [EMAIL PROTECTED] -----Original Message----- From: Barry Kelly [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 23, 2006 10:34 AM To: [email protected] Subject: Re: [ADVANCED-DOTNET] Guid question "Hevel, Shawn" <[EMAIL PROTECTED]> wrote: > I've got a Guid 36 positions long. I need a way to encrypt this and decript > this value. When I encrypt the value the length can be no longer than 30 > positions. Is there a way to encrypt the Guid into a length of 30 and > decript is back to a length of 36, without losing the original value of the > Guid? If obfuscation is all you need, you can Base64 encode the byte array form of the guid, it'll end up around 24 characters or so: ---8<--- using System; class App { static void Main() { Guid guid = Guid.NewGuid(); string encoded = Convert.ToBase64String( guid.ToByteArray()); Console.WriteLine(encoded); Console.WriteLine(encoded.Length); } } --->8--- Do the reverse to get it back. -- Barry -- http://barrkel.blogspot.com/ =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
