The application is to create software registration codes from a seed. This is what I have so far:
This gives me tmpCode at a string of hexadecimal values. If I do this;
I get tmpCode with letters and numbers but also assorted other charactors.
What I want it so convert the byte array to letters and numbers only and not punctuation or other charactors. How do I avoid any of the non numeric or non alpha charactors?
Thanks for any ideas you have.
Bernie
VB.NET:
Dim hash As HashAlgorithm
Dim tmpCode As String
Dim codeBytes As Byte()
Dim seedBytes As Byte()
' create hash as SHA1 ...
hash = New SHA1Managed
' calculate the hash ...
codeBytes = hash.ComputeHash(seedBytes)
' convert to string ...
For Each b In codeBytes
tmpCode += b.ToString("x2")
Next
VB.NET:
'tmpCode = Convert.ToBase64String(codeBytes)
What I want it so convert the byte array to letters and numbers only and not punctuation or other charactors. How do I avoid any of the non numeric or non alpha charactors?
Thanks for any ideas you have.
Bernie