From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 14 Aug 2019 22:50:43 +0800 Subject: +Unity Runtime code --- Runtime/Export/Windows/WindowsCrypto.txt | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Runtime/Export/Windows/WindowsCrypto.txt (limited to 'Runtime/Export/Windows/WindowsCrypto.txt') diff --git a/Runtime/Export/Windows/WindowsCrypto.txt b/Runtime/Export/Windows/WindowsCrypto.txt new file mode 100644 index 0000000..56daa50 --- /dev/null +++ b/Runtime/Export/Windows/WindowsCrypto.txt @@ -0,0 +1,46 @@ +C++RAW + +#include "UnityPrefix.h" +#include "Runtime/Mono/MonoManager.h" +#include "Runtime/Scripting/ScriptingUtility.h" +#include "Runtime/Scripting/ScriptingExportUtility.h" +#include "Runtime/Utilities/File.h" +#include "Runtime/Utilities/HashFunctions.h" + + +using namespace Unity; + +using namespace std; + +CSRAW +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using UnityEngineInternal; + +namespace UnityEngine.Windows +{ +CONDITIONAL UNITY_WINRT_API +CLASS Crypto + CUSTOM public static byte[] ComputeMD5Hash(byte[] buffer) + { + UInt8* first = Scripting::GetScriptingArrayStart (buffer); + int size = GetScriptingArraySize(buffer); + UInt8 outHash[16]; + ComputeMD5Hash(first, size, outHash); + return CreateScriptingArray(outHash, sizeof(outHash), GetMonoManager().GetCommonClasses().byte); + } + + CUSTOM public static byte[] ComputeSHA1Hash(byte[] buffer) + { + UInt8* first = Scripting::GetScriptingArrayStart (buffer); + int size = GetScriptingArraySize(buffer); + UInt8 outHash[20]; + ComputeSHA1Hash(first, size, outHash); + return CreateScriptingArray(outHash, sizeof(outHash), GetMonoManager().GetCommonClasses().byte); + } +CSRAW +END + +CSRAW +} -- cgit v1.1-26-g67d0