SHA256 HMAC In CSharp
From the makers of InspIRCd.
![]() |
Development Material - Information posted here is for developer reference only. This material is subject to possible change and will be technical in nature. |
The following is an implementation of the SHA256 HMAC authentication used in protocol versions 1202 and above:
using System.Text; using System.Security.Cryptography; public static string GenerateNewHMAC(string password, string challenge) { HMACSHA256 hmc = new HMACSHA256(Encoding.ASCII.GetBytes(password)); byte[] hmres = hmc.ComputeHash(Encoding.ASCII.GetBytes(challenge)); return Convert.ToBase64String(hmres).Replace("=", ""); }