im trying to convert a byte array from a hash function into a string, i used a bitconverter.tostring() at first but it just creates a string with all uppercase bytes separated by dashes
This is my basic method
public string Hash(string password)
{
using var hasher = SHA512.Create();
{
var asBytes = Encoding.Default.GetBytes(password);
var hashed = hasher.ComputeHash(asBytes);
string stringhashed = BitConverter.ToString(hashed);
return stringhashed;
}
}
the output hashes correctly, however it gets formated into a string as BYTE-BYTE-BYTE-BYTE-BYTE.... while i needed the output to be a normal string, with lowercase and all. Is there any way to convert a byte array into a string meeting these requirements?