I have a program that, using AES symmetric encryption, can encrypt any given plain text and returns the encrypted values as a byte of arrays. This encrypted password is then stored in a database (as a varbinary type) to be later retrieved by the project, and decrypt it. The program works fine, but while I was building it using MSDN's example as a base, I came across several other examples that after getting the encrypted value, they would return it as a Base64 string, like this:
return Convert.ToBase64String(encrypted);
And store that string in the database. Likewise, when decrypting the password it received a Base64 as a parameter and turned it back to its byte array representation before continuing with the process.
byte[] cipherTextAsBytes = Convert.FromBase64String(cipherText);
My question is, why I should I use this approach when managing my passwords? The way I see it, it just serves to add a couple more lines in my code that could have been omitted without problem (unless this step adds another layer to delay a brute-force cryptographic attack?). Is it a matter of memory in the database (as in, would a varbinary value consume more storage space than its string counterpart?), a matter of performance speed in the code, to make it easier for debugging while comparing values, or just an aesthetic preference?