Updated filebase64sha256 function
This commit is contained in:
parent
809cf11d79
commit
4bc8ee0316
|
@ -126,13 +126,13 @@ func getHelperMethodIfNeeded(functionName string) (string, bool) {
|
||||||
switch functionName {
|
switch functionName {
|
||||||
case "filebase64":
|
case "filebase64":
|
||||||
return `private static string ReadFileBase64(string path) {
|
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
|
}`, true
|
||||||
case "filebase64sha256":
|
case "filebase64sha256":
|
||||||
return `private static string ComputeFileBase64Sha256(string path) {
|
return `private static string ComputeFileBase64Sha256(string path) {
|
||||||
var fileData = System.Text.UTF8.GetBytes(File.ReadAllText(path))
|
var fileData = Encoding.UTF8.GetBytes(File.ReadAllText(path));
|
||||||
var hashData = SHA256.Create().ComputeHash(fileData)
|
var hashData = SHA256.Create().ComputeHash(fileData);
|
||||||
return Convert.ToBase64String(BitConverter.ToString(hashData).Replace("-","").ToLowerInvariant())
|
return Convert.ToBase64String(hashData);
|
||||||
}`, true
|
}`, true
|
||||||
case "sha1":
|
case "sha1":
|
||||||
return `private static string ComputeSHA1(string input) {
|
return `private static string ComputeSHA1(string input) {
|
||||||
|
|
Loading…
Reference in a new issue