• Kevin Burke's avatar
    crypto/sha256: add examples for New, Sum256 · 448d3952
    Kevin Burke authored
    The goal for these examples is to show how to mirror the
    functionality of the sha256sum Unix utility, a common checksumming
    tool, using the Go standard library.
    
    Add a newline at the end of the input, so users will get the same
    output if they type `echo 'hello world' | sha256sum`, since the
    builtin shell echo appends a newline by default. Also use hex output
    (instead of the shorter base64) since this is the default output
    encoding for shasum/sha256sum.
    
    Change-Id: I0036874b3cc5ba85432bfcb86f81b51c4e0238fd
    Reviewed-on: https://go-review.googlesource.com/24868Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
    Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    448d3952
example_test.go 572 Bytes