forked from XeCrash/NETLock
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInnerLock.cs
More file actions
42 lines (38 loc) · 1.23 KB
/
InnerLock.cs
File metadata and controls
42 lines (38 loc) · 1.23 KB
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
using System;
using System.IO;
using System.Text;
/*
* Read the read me or look at the example applications if you want to know how to use this to protect youself from
* modified or cracked file versions of NETLock.dll from being used on your application. -XeCrash
*
* Created On: Tuesday, September 19th, 2017 at 4:18:48 AM EST
*
* Special thanks to SDK from BetterSeal!
*/
public class InnerLock
{
private static string CurrentMD5 = ""; //You would put the MD5 value you obtained from the MD5 file checker in the admin panel
public static void Check()
{
if (ComputeHash($"{AppDomain.CurrentDomain.BaseDirectory}NETLock.dll") != CurrentMD5)
{
Environment.Exit(2134);
}
}
private static string ComputeHash(string s)
{
using (var md5 = System.Security.Cryptography.MD5.Create())
{
using (var stream = File.OpenRead(s))
{
byte[] hash = md5.ComputeHash(stream);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hash.Length; i++)
{
sb.Append(hash[i].ToString("X2"));
}
return sb.ToString();
}
}
}
}