Should I encode the data before hashing it to avoid Invalid length for a Base-64 char array
.
# my .cs :
Stream des = file.InputStream;
byte[] data = new byte[file.ContentLength];
des.Read(data, 0, file.ContentLength);
FileStream f = new FileStream(targetFileName, FileMode.Create, FileAccess.ReadWrite);
f.Write(data, 0, data.Length);
f.Flush();
f.Close();
///////////////////////////////////////////////////////////////////////////////////////////
var sha = new System.Security.Cryptography.SHA512Managed();
string hash2 = Convert.ToBase64String(sha.ComputeHash(data));
and if the answer is yes How to encode the byte array.
Note:
I use hashing to uniquely identify the uploaded files for any change.