blob: 56daa507944e121b2632a96d04162eac9662a324 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
}
|