I\'m trying to write a function that converts a string to a base64 byte array. I\'ve tried with this approach:
public byte[] stringToBase64ByteArray(String input
Looks okay, although the approach is strange. But use Encoding.ASCII.GetBytes() to convert the base64 string to byte[]. Base64 encoding only contains ASCII characters. Using Unicode gets you an extra 0 byte for each character.