diff options
author | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
commit | 15740faf9fe9fe4be08965098bbf2947e096aeeb (patch) | |
tree | a730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Export/Windows/WindowsCrypto.txt |
Diffstat (limited to 'Runtime/Export/Windows/WindowsCrypto.txt')
-rw-r--r-- | Runtime/Export/Windows/WindowsCrypto.txt | 46 |
1 files changed, 46 insertions, 0 deletions
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<UInt8> (buffer); + int size = GetScriptingArraySize(buffer); + UInt8 outHash[16]; + ComputeMD5Hash(first, size, outHash); + return CreateScriptingArray<UInt8>(outHash, sizeof(outHash), GetMonoManager().GetCommonClasses().byte); + } + + CUSTOM public static byte[] ComputeSHA1Hash(byte[] buffer) + { + UInt8* first = Scripting::GetScriptingArrayStart<UInt8> (buffer); + int size = GetScriptingArraySize(buffer); + UInt8 outHash[20]; + ComputeSHA1Hash(first, size, outHash); + return CreateScriptingArray<UInt8>(outHash, sizeof(outHash), GetMonoManager().GetCommonClasses().byte); + } +CSRAW +END + +CSRAW +} |