0

I have a function that generates a random Base64 String

Public Shared Function GenerateSalt() As String
 Dim rng As RNGCryptoServiceProvider = New RNGCryptoServiceProvider
 Dim buff(94) As Byte
 rng.GetBytes(buff)
 Return Convert.ToBase64String(buff)
End Function

This will always return a 128 Character String. I then take that string and divide it into 4 substrings. I then merge that all back into one big string called MasterSalt like so

MasterSalt = (Salt.Substring(1,32)) + "©" + (Salt.Substring(32,32)) + "©" + etc...

I am doing this because I then put all of this into an array and say Split(MasterSalt, "©")

My concern is I am not overly confident in the stability of using "©" as the delimiter to define where the string should be split. However I have to use something that is not going to be included in the randomly generated base64string. I would like it to be something that can be found on a standard keyboard if possible. So to be clear my question is: is there a glyph or character on a standard keyboard that would never be included in a randomly generated base64string??

aaronmallen
  • 1,418
  • 1
  • 12
  • 29

1 Answers1

1

Base64 uses 64 characters to encode 6 bits of the content at a time as values 0-63;

A-Z  (0-25)
a-z  (26-51)
0-9  (52-61)
+    (62)
/    (63)

...and it uses = as filler at the end if required.

Any other character will be available for you to use as a delimiter, for example space, period and minus.

Joachim Isaksson
  • 176,943
  • 25
  • 281
  • 294