baze64 length
public int GetOriginalLengthInBytes(string base64string)
{
if (string.IsNullOrEmpty(base64string)) { return 0; }
var characterCount = base64string.Length;
var paddingCount = base64string.Substring(characterCount - 2, 2)
.Count(c => c == '=');
return (3 * (characterCount / 4)) - paddingCount;
}