diff --git a/pkg/codegen/dotnet/utilities.go b/pkg/codegen/dotnet/utilities.go index 50b643bb7..af7353909 100644 --- a/pkg/codegen/dotnet/utilities.go +++ b/pkg/codegen/dotnet/utilities.go @@ -126,13 +126,13 @@ func getHelperMethodIfNeeded(functionName string) (string, bool) { switch functionName { case "filebase64": return `private static string ReadFileBase64(string path) { - return Convert.ToBase64String(System.Text.UTF8.GetBytes(File.ReadAllText(path))) + return Convert.ToBase64String(Encoding.UTF8.GetBytes(File.ReadAllText(path))) }`, true case "filebase64sha256": return `private static string ComputeFileBase64Sha256(string path) { - var fileData = System.Text.UTF8.GetBytes(File.ReadAllText(path)) - var hashData = SHA256.Create().ComputeHash(fileData) - return Convert.ToBase64String(BitConverter.ToString(hashData).Replace("-","").ToLowerInvariant()) + var fileData = Encoding.UTF8.GetBytes(File.ReadAllText(path)); + var hashData = SHA256.Create().ComputeHash(fileData); + return Convert.ToBase64String(hashData); }`, true case "sha1": return `private static string ComputeSHA1(string input) {