🍋
Menu
Security

SHA-256

Secure Hash Algorithm 256-bit

A cryptographic hash function producing a 256-bit digest, widely used for data integrity verification.

Technical Detail

SHA-256 produces a 256-bit (32-byte) digest from any input size. It's collision-resistant: finding two inputs with the same hash requires ~2^128 operations (birthday attack bound). SHA-256 is used in TLS certificates, Bitcoin proof-of-work, Git object addressing, and digital signatures. Related functions: SHA-384 and SHA-512 use 64-bit operations and are faster on 64-bit processors. SHA-3 (Keccak) is an independent design from the SHA-2 family, providing a fallback if SHA-2 is ever compromised.

Example

```javascript
// SHA-256 — Web Crypto API example
const data = new TextEncoder().encode('sensitive data');
const hash = await crypto.subtle.digest('SHA-256', data);
const hex = Array.from(new Uint8Array(hash))
  .map(b => b.toString(16).padStart(2, '0')).join('');
```

Related Tools

Related Terms