using System.Security.Cryptography;
using System.Globalization;
public static byte[] StringToByteArray(string hex) {
return Enumerable.Range(0, hex.Length)
.Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
private static byte[] ComputeHash(string userIdentifier, string password, byte[] salt)
string tmpPassword = userIdentifier.ToLower() + password + Convert.ToBase64String(salt);
var textConverter = new UTF8Encoding();
byte[] passBytes = textConverter.GetBytes(tmpPassword);
return new SHA384Managed().ComputeHash(passBytes);
public static string ByteArrayToString(byte[] input)
var sb = new StringBuilder();
sb.AppendFormat("{0:X2}", b);
public static void Main()
var result = StringToByteArray("08EED1A96223");
var output = ByteArrayToString(result);
Console.WriteLine(ByteArrayToString(ComputeHash("866", "", StringToByteArray("08EED1A96223"))));
Console.WriteLine(output);