I have encoded a string into Base64 for the purpose of encryption. I
then later decrypted it and converted it back from Base64 the final
string returns with four nothing characters.
"pass" what the result should be
"pass____ what the result is where each underline char is a nothing
char.
I am about to write a function that will remove the nothing chars butI
would like to know what is causing the problem and simply avoid it
instead.
Encoding code:
Private Shared Function EncodeBase64(By Val message As String) As
String
Dim encodeBuffer As Byte() =
System.Text.Enc oding.Unicode.G etBytes(message )
Return Convert.ToBase6 4String(encodeB uffer)
End Function
Decoding Code:
Private Shared Function DecodeBase64(By Val decodeBuffer As Byte()) As
String
Return System.Text.Enc oding.Unicode.G etString(decode Buffer)
End Function
I believe that the encryption is working as intended
DecodeBase64(De crypt(password, crypto)) is the line that returns the
wrong string.
Thanks for any help
Jeremy
then later decrypted it and converted it back from Base64 the final
string returns with four nothing characters.
"pass" what the result should be
"pass____ what the result is where each underline char is a nothing
char.
I am about to write a function that will remove the nothing chars butI
would like to know what is causing the problem and simply avoid it
instead.
Encoding code:
Private Shared Function EncodeBase64(By Val message As String) As
String
Dim encodeBuffer As Byte() =
System.Text.Enc oding.Unicode.G etBytes(message )
Return Convert.ToBase6 4String(encodeB uffer)
End Function
Decoding Code:
Private Shared Function DecodeBase64(By Val decodeBuffer As Byte()) As
String
Return System.Text.Enc oding.Unicode.G etString(decode Buffer)
End Function
I believe that the encryption is working as intended
DecodeBase64(De crypt(password, crypto)) is the line that returns the
wrong string.
Thanks for any help
Jeremy
Comment