SHA-512 Hash Generator

📄 BetterWays.dev wiki page | 🕑 Last updated: Sep 13, 2022

A quick and clean online tool to generate a SHA-512 hash from a string.

Enter your input string:

🔨 More Tools


SHA-512 is a part of the set of SHA-2 cryptographic hash functions designed by NSA. Other novel function in SHA-2 family is SHA-256 (there are also truncated versions SHA-224, SHA-384, SHA-512/224, and SHA-512/256).

SHA-2 is based on Merkle–Damgård construction and is considered safe in most applications.

Examples of use in popular programming languages/environments:

Shell

sha512sum (part of the coreutils package) and openssl are two commonly used tools for this purpose:

echo -n "Hello" | sha512sum

echo -n "Hello" | openssl sha512

(echo -n omits the new line, otherwise the new line character will be included as an input to the hashing function)

JavaScript

Until recently, there was no native SHA support in browsers, but new SubtleCrypto interface (part of the Web Crypto API) can be used for this purpose:

async function sha1(message) {
    // encode as UTF-8
    const msgBuffer = new TextEncoder().encode(message);                    

    // hash the message
    const hashBuffer = await crypto.subtle.digest('SHA-512', msgBuffer);

    // convert ArrayBuffer to Array
    const hashArray = Array.from(new Uint8Array(hashBuffer));

    // convert bytes to hex string                  
    const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
    return hashHex;
}

sha1('Hello').then(res => console.log)

Alternatively, there are many 3rd party libs, like CryptoJS:

console.log(CryptoJS.SHA512('Hello'));

Comments and suggestions

You can use this form to submit a suggestion or a comment.

If you find this site useful, please consider supporting it. Supporters also get access to some extras.