Sha3-512 Hash Generator Online

Generate Sha3-512 code

Enter string to convert to SHA3-512

What is SHA3-512?

SHA3-512 is a cryptographic hash function that has been standardized by the National Institute of Standards and Technology (NIST) as part of the SHA-3 family of algorithms. SHA3-512 is a one-way cryptographic function that takes an input string of any length and produces a 512-bit output string of fixed length.  

What is it usually used for, when?

SHA3-512 is usually used to verify the integrity and authenticity of digital data. It can be used to generate digital signatures, to generate hash values for data integrity verification, or to generate a unique identifier for data. It is also used in encryption and decryption algorithms and is often used as a key derivation function.  

How does it work?

SHA3-512 is based on the Keccak cryptographic hash function developed by Guido Bertoni, Joan Daemen, Michaël Peeters, and Gilles Van Assche. SHA3-512 works by taking an input message and running it through a compression function to generate a 512-bit output. The compression function is a permutation that takes a fixed-length string of bits as input and produces a fixed-length string of bits as output. The output is then used as the input for a second round of the compression function, and so on, until a 512-bit output is obtained.  

What programming languages support it?

SHA3-512 is supported by many programming languages, including Node.js, PHP, Java, C#, Python, Go, Dart, Swift, and C++.  

Example code in Node.js

const crypto = require('crypto');
const hash = crypto.createHash('sha3-512');

hash.update('myData');

const output = hash.digest('hex');

console.log(output);

Example code in PHP 

<?php
$data = 'myData';

$hash = hash('sha3-512', $data);

echo $hash;

Example code in Java 

import java.security.MessageDigest; 

public class SHA3_512 { 
    public static byte[] getSHA3_512(String input) throws NoSuchAlgorithmException { 
        MessageDigest md = MessageDigest.getInstance("SHA3-512"); 
        return md.digest(input.getBytes(StandardCharsets.UTF_8)); 
    } 

    public static String toHexString(byte[] hash) { 
        // Convert byte array into signum representation 
        BigInteger number = new BigInteger(1, hash); 
  
        // Convert message digest into hex value 
        StringBuilder hexString = new StringBuilder(number.toString(16)); 
  
        // Pad with leading zeros 
        while (hexString.length() < 32) { 
            hexString.insert(0, '0'); 
        } 
  
        return hexString.toString(); 
    } 
  
    public static void main(String[] args) throws NoSuchAlgorithmException { 
        System.out.println("Hash: " + toHexString(getSHA3_512("myData"))); 
    } 
}

Example code in C#

using System.Security.Cryptography;

public static string GenerateSHA3_512Hash(string input)
{
    SHA3 sha3 = SHA3.Create();
    byte[] inputBytes = Encoding.ASCII.GetBytes(input);
    byte[] hash = sha3.ComputeHash(inputBytes);

    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < hash.Length; i++)
    {
        sb.Append(hash[i].ToString("X2"));
    }

    return sb.ToString();
}

Example code in Python 

import hashlib

def sha3_512_hash(input):
    return hashlib.sha3_512(input.encode()).hexdigest()

Example code in Go Lang
package main

import (
    "crypto/sha3"
    "fmt"
)

func main() {
    message := []byte("myData")
    hash := sha3.Sum512(message)
    fmt.Printf("%x\n", hash)
}

Example code in Dart

import 'package:crypto/crypto.dart';

String sha3_512Hash(String input) {
  var bytes = utf8.encode(input);
  var digest = sha3.sha3_512.convert(bytes);
  return digest.toString();
}

Example code in Swift 

import Crypto

func sha3_512Hash(input: String) -> String {
    let bytes = [UInt8](input.utf8)
    let digest = SHA3(variant: .sha3_512).calculate(for: bytes)
    return digest.toHexString()
}

Example code in C++ 

#include <iostream>
#include <string>
#include <cryptopp/sha3.h>

int main()
{
    std::string input = "myData";
    byte digest[CryptoPP::SHA3_512::DIGESTSIZE]; 

    CryptoPP::SHA3_512().CalculateDigest(digest, (byte*)input.data(), input.length());

    std::cout << "SHA3-512: ";
    for (int i = 0; i < CryptoPP::SHA3_512::DIGESTSIZE; i++)
        std::cout << std::hex << (int)digest[i];
    std::cout << std::endl;

    return 0;
}