C# 此算法的base64编码salt/密码的最大长度

C# 此算法的base64编码salt/密码的最大长度,c#,sql-server,encoding,character-encoding,base64,C#,Sql Server,Encoding,Character Encoding,Base64,下面是我正在重写的应用程序中用于散列密码的代码片段: internal string GenerateSalt() { byte[] buf = new byte[16]; (new RNGCryptoServiceProvider()).GetBytes(buf); return Convert.ToBase64String(buf); } internal string EncodePassword(strin

下面是我正在重写的应用程序中用于散列密码的代码片段:

    internal string GenerateSalt()
    {
        byte[] buf = new byte[16];
        (new RNGCryptoServiceProvider()).GetBytes(buf);
        return Convert.ToBase64String(buf);
    }

    internal string EncodePassword(string pass, string salt)
    {
        byte[] bIn = Encoding.Unicode.GetBytes(pass);
        byte[] bSalt = Convert.FromBase64String(salt);
        byte[] bAll = new byte[bSalt.Length + bIn.Length];

        Buffer.BlockCopy(bSalt, 0, bAll, 0, bSalt.Length);
        Buffer.BlockCopy(bIn, 0, bAll, bSalt.Length, bIn.Length);
        HashAlgorithm s = HashAlgorithm.Create("SHA512");
        byte[] bRet = s.ComputeHash(bAll);

        return Convert.ToBase64String(bRet);
    }

散列密码和salt随后存储在数据库中。base64编码的salt和密码的最大长度是多少

由于SHA-512哈希总是512位=64字节,base64需要
(n+2-((n+2)%3))/3*4
字节,因此存储数据总是需要88字节