crypto/sha256

Sum256 & Sum224

package main

import (
    "crypto/sha256"
    "encoding/hex"
    "fmt"
)

func main() {
    data := []byte("Hello world")

    sum256 := sha256.Sum256(data)
    fmt.Println(hex.EncodeToString(sum256[:]))
    // 64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c

    sum224 := sha256.Sum224(data)
    fmt.Println(hex.EncodeToString(sum224[:]))
    // ac230f15fcae7f77d8f76e99adf45864a1c6f800655da78dea956112
}