===== crypto/sha256 ===== ==== What is it? ==== `crypto/sha256` provides the SHA-256 cryptographic hash function. ==== What is it used for? ==== * Generate a fixed-length digest (hash) from data. * Verify integrity (data has not changed). * Used in signatures, checksums, and many security protocols. ==== Example (Sum256) ==== package main import ( "crypto/sha256" "fmt" ) func main() { sum := sha256.Sum256([]byte("hello")) fmt.Printf("%x\n", sum) } ==== Notes ==== * SHA-256 is a hash, not encryption. * For password hashing, use `bcrypt/scrypt/argon2` (do not use plain SHA-256). ==== Related pages ==== * [[go:crypto:md5|crypto/md5]] * [[go:crypto:hmac|crypto/hmac]] * [[go:crypto:sha512|crypto/sha512]] ==== Hard words (English) ==== * **digest** /ˈdaɪdʒest/: bản băm (kết quả hash) * **integrity** /ɪnˈteɡrɪti/: tính toàn vẹn * **encryption** /ɪnˈkrɪpʃən/: mã hoá * **checksum** /ˈtʃeksʌm/: mã kiểm tra