exaple, string "test" in https://md5calc.com/hash/sha3-512/test gives me "9ece086e9bac491fac5c1d1046ca11d737b92a2b2ebd93f005d7b710110c0a678288166e7fbe796883a4f2e9b3ca9f484f521d0ce464345cc1aec96779149c14"
but
using HashLib; // from https://www.nuget.org/packages/HashLib
using System;
class Program
{
static void Main(string[] args)
{
var sha3512 = HashFactory.Crypto.SHA3.CreateKeccak512();
var tempHash = sha3512.ComputeString("test");
Console.WriteLine(tempHash.ToString().ToLower().Replace("-", ""));
}
}
returns "3abff7b1f2042ac3861bd4c0b40efaa8a695909bfb31753fc7b1bd69778de1225a627c8f07cf4814cc05435ada2a1ffee3f4513a8867154274787624f24e551b"
i need to get first string, not that hashlib provides.
You can use BouncyCastle. It has an SHA3 implementation.
var hashAlgorithm = new Org.BouncyCastle.Crypto.Digests.Sha3Digest(512);
// Choose correct encoding based on your usecase
byte[] input = Encoding.ASCII.GetBytes("test");
hashAlgorithm.BlockUpdate(input, 0, input.Length);
byte[] result = new byte[64]; // 512 / 8 = 64
hashAlgorithm.DoFinal(result, 0);
string hashString = BitConverter.ToString(result);
hashString = hashString.Replace("-", "").ToLowerInvariant();
Console.WriteLine(hashString);
Output is
9ece086e9bac491fac5c1d1046ca11d737b92a2b2ebd93f005d7b710110c0a678288166e7fbe796883a4f2e9b3ca9f484f521d0ce464345cc1aec96779149c14