using System; using System.Security.Cryptography; using System.Text; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; namespace nboard { class Program { static void Main() { Console.WriteLine(HashCalculator.Calculate("test")); } } static class NanoEncoding { static string charset = "?!\"#$%&'()*+,-./0123456789:;<=> @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"+ "ЎўЄєІіЇїАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюяčšžćśźńŭłČŠŽĆŚŽŽŬŁ" + "№©«»±®Ґґ°™—“”’‘…–\n\r\t"; public static byte[] GetBytes(string str) { byte[] bytes = new byte[str.Length]; int i = 0; foreach (var c in str) { int iof = charset.IndexOf(c); if (iof == -1) bytes[i++] = 0; else bytes[i++] = (byte)iof; } return bytes; } public static string GetString(byte[] bytes) { char[] chars = new char[bytes.Length]; int i = 0; foreach (var b in bytes) { if (b > charset.Length) chars[i++] = '?'; else chars[i++] = charset[b]; } return new string(chars); } } static class HashCalculator { public const int HashCrop = 16; public static string Calculate(string raw) { byte[] bhash = SHA256.Create().ComputeHash(NanoEncoding.GetBytes(raw)); StringBuilder sb = new StringBuilder(); for (int i = 0; i < HashCrop; i++) { sb.Append(bhash[i].ToString("x2")); } return sb.ToString(); } } }