Server IP : 103.6.199.200 / Your IP : 3.14.251.103 Web Server : Microsoft-IIS/10.0 System : Windows NT EMPUSA 10.0 build 20348 (Windows Server 2016) i586 User : EMPUSA$ ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Domains/iscommy2/ws.i-3s.com.my/i3sWebServiceStg/ |
Upload File : |
using System.Security.Cryptography; using System.Text; namespace i3sWebService { public class SHA1Class { /// <summary> /// Compute hash for string encoded as UTF8 /// </summary> /// <param name="s">String to be hashed</param> /// <returns>40-character hex string</returns> public string SHA1HashStringForUTF8String(string s) { SHA1 sha = new SHA1CryptoServiceProvider(); byte[] bytes = Encoding.UTF8.GetBytes(s); //HashAlgorithm algorithm = SHA1.Create(); byte[] hashBytes = sha.ComputeHash(bytes); return HexStringFromBytes(hashBytes); } /// <summary> /// Convert an array of bytes to a string of hex digits /// </summary> /// <param name="bytes">array of bytes</param> /// <returns>String of hex digits</returns> public string HexStringFromBytes(byte[] bytes) { var sb = new StringBuilder(); foreach (byte b in bytes) { var hex = b.ToString("x2"); sb.Append(hex); } return sb.ToString(); } } }