Hashing Algorithms
Last updated
Last updated
{service}_{method}_{method provider}_{order id}_{secondary key}{order id}_{secondary key}using System;
using System.Security.Cryptography;
using System.Text;
public class HashGenerator
{
public static string ComputeSHA256Hash(string input)
{
using (SHA256 sha256 = SHA256.Create())
{
byte[] inputBytes = Encoding.UTF8.GetBytes(input);
byte[] hashBytes = sha256.ComputeHash(inputBytes);
StringBuilder builder = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
builder.Append(hashBytes[i].ToString("x2"));
}
return builder.ToString();
}
}
}import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class HashGenerator {
public static String computeSHA256Hash(String input) throws NoSuchAlgorithmException {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] hashBytes = digest.digest(input.getBytes());
StringBuilder builder = new StringBuilder();
for (byte b : hashBytes) {
builder.append(String.format("%02x", b));
}
return builder.toString();
}
}
const crypto = require('crypto');
function computeSHA256Hash(input) {
const hash = crypto.createHash('sha256');
hash.update(input);
return hash.digest('hex');
}