public static String generateHash(String apiKey, String secretKey, String randomString, BaseRequest request) { HashAlgorithm algorithm = new SHA1Managed(); string hashStr = apiKey + randomString + secretKey + request.ToPKIRequestString(); byte[] computeHash = algorithm.ComputeHash(Encoding.UTF8.GetBytes(hashStr)); return Convert.ToBase64String(computeHash); }
public static String generateHash(String apiKey, String secretKey, String randomString, BaseRequest request) { HashAlgorithm algorithm = SHA1.Create(); string hashStr = apiKey + randomString + secretKey + request.ToPKIRequestString(); byte[] computeHash = algorithm.ComputeHash(Encoding.UTF8.GetBytes(hashStr)); return(Convert.ToBase64String(computeHash)); }
public static String GenerateHash(String apiKey, String secretKey, String randomString, BaseRequest request) { #if NETSTANDARD SHA1 algorithm = SHA1.Create(); #else HashAlgorithm algorithm = new SHA1Managed(); #endif string hashStr = apiKey + randomString + secretKey + request.ToPKIRequestString(); byte[] computeHash = algorithm.ComputeHash(Encoding.UTF8.GetBytes(hashStr)); return(Convert.ToBase64String(computeHash)); }