diff --git a/SRC/Aura_OS/Properties/VersionInfo.cs b/SRC/Aura_OS/Properties/VersionInfo.cs index 2d9e15a2..fb5eb339 100644 --- a/SRC/Aura_OS/Properties/VersionInfo.cs +++ b/SRC/Aura_OS/Properties/VersionInfo.cs @@ -2,6 +2,6 @@ namespace Aura_OS { public class VersionInfo { - public static string revision = "030320241840"; + public static string revision = "030320241846"; } } diff --git a/SRC/Aura_OS/System/Processing/Interpreter/UniLua/LuaCosmosCryptoLib.cs b/SRC/Aura_OS/System/Processing/Interpreter/UniLua/LuaCosmosCryptoLib.cs index a8590359..34dc3e0d 100644 --- a/SRC/Aura_OS/System/Processing/Interpreter/UniLua/LuaCosmosCryptoLib.cs +++ b/SRC/Aura_OS/System/Processing/Interpreter/UniLua/LuaCosmosCryptoLib.cs @@ -41,9 +41,8 @@ private static int CRYPTO_md5(ILuaState lua) private static int CRYPTO_sha256(ILuaState lua) { string input = lua.L_CheckString(1); - var hashAlgorithm = new SHA256(); - var hashBytes = hashAlgorithm.ComputeHash(Encoding.UTF8.GetBytes(input)); - lua.PushString(ToHexString(hashBytes)); + var hashBytes = Aura_OS.System.Security.Sha256.hash(Encoding.UTF8.GetBytes(input)); + lua.PushString(hashBytes); return 1; } @@ -71,12 +70,9 @@ private static int FILE_CRYPTO_md5(ILuaState lua) private static int FILE_CRYPTO_sha256(ILuaState lua) { string filePath = Path.Combine(Kernel.CurrentDirectory, lua.L_CheckString(1)); - var hashAlgorithm = new SHA256(); - using (var stream = File.OpenRead(filePath)) - { - var hashBytes = hashAlgorithm.ComputeHash(stream); - lua.PushString(ToHexString(hashBytes)); - } + byte[] file = File.ReadAllBytes(filePath); + var hashBytes = Aura_OS.System.Security.Sha256.hash(file); + lua.PushString(hashBytes); return 1; } diff --git a/SRC/Aura_OS/System/Security/SHA256.cs b/SRC/Aura_OS/System/Security/SHA256.cs index 2f14cc99..c548743e 100644 --- a/SRC/Aura_OS/System/Security/SHA256.cs +++ b/SRC/Aura_OS/System/Security/SHA256.cs @@ -25,6 +25,11 @@ public class Sha256 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 }; + public static string hash(byte[] tohash) + { + return Sha256.ComputeHash(tohash).ToUpperInvariant(); + } + public static string hash(string tohash) { return Sha256.ComputeHash(Encoding.ASCII.GetBytes(tohash)).ToUpperInvariant();