Text Hash Generator

Generate cryptographic hash values of text using MD5, SHA-256, SHA-384, and SHA-512 algorithms

About Hash Functions

Hash functions are mathematical algorithms that convert data of arbitrary size to a fixed-size string of characters. They are designed to be one-way functions, making it practically impossible to reverse the process and generate the original input from the hash.

Key properties of cryptographic hash functions:

  • Deterministic: The same input will always produce the same hash output
  • Fast to compute: It should be quick to calculate the hash of any input
  • Pre-image resistance: Given a hash value, it should be difficult to find any input that hashes to that value
  • Small changes cause big differences: A small change in the input produces a completely different hash output
  • Collision resistance: It should be difficult to find two different inputs that hash to the same output

Security Note: MD5 and SHA-1 are considered cryptographically broken and should not be used for security purposes. SHA-256 and above are currently considered secure for most applications.

Hash Examples

Below are examples of how the text Hello World is hashed using different algorithms:

AlgorithmOutput HashLengthSecurity Status
MD5b10a8db164e0754105b7a99be72e3fe5128 bitsNot secure (broken)
SHA-10a4d55a8d778e5022fab701977c5d840bbc486d0160 bitsNot secure (broken)
SHA-256a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e256 bitsSecure
SHA-38499514329186b2f6ae4a1329e7ee6c610a729636335174ac6b740f9028396fcc803d0e93863a7c3d90f86beee782f4f3f384 bitsSecure
SHA-5122c74fd17edafd80e8447b0d46741ee243b7eb74dd2149a0ab1b9246fb30382f27e853d8585719e0e67cbda0daa8f51671064615d645ae27acb15bfb1447f459b512 bitsVery secure

Hash Functions in Different Languages

Here are examples of how to generate SHA-256 hashes in different programming languages:

JavaScript (Node.js):


const crypto = require('crypto');
const hash = crypto.createHash('sha256').update('Hello World').digest('hex');
// Result: 'a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e'
                

Python:


import hashlib
hash_object = hashlib.sha256(b'Hello World')
hex_dig = hash_object.hexdigest()
# Result: 'a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e'
                

PHP:


$hash = hash('sha256', 'Hello World');
// Result: 'a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e'