| commit | 448d3952af2e60eab7fddd0d8a7b8e0ea6905073 | [log] [tgz] |
|---|---|---|
| author | Kevin Burke <kev@inburke.com> | Tue Jul 12 16:54:36 2016 -0700 |
| committer | Brad Fitzpatrick <bradfitz@golang.org> | Wed Aug 31 05:13:48 2016 +0000 |
| tree | c5aedb228f64d76f7e296a87266052142cac451f | |
| parent | 3968ac2caf4b7bbabcad6504ab5e3589fc525b1e [diff] |
crypto/sha256: add examples for New, Sum256 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/24868 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
For documentation about how to install and use Go, visit https://golang.org/ or load doc/install-source.html in your web browser.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Go is the work of hundreds of contributors. We appreciate your help!
To contribute, please read the contribution guidelines: https://golang.org/doc/contribute.html
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
If you have just untarred a binary Go distribution, you need to set the environment variable $GOROOT to the full path of the go directory (the one containing this file). You can omit the variable if you unpack it into /usr/local/go, or if you rebuild from sources by running all.bash (see doc/install-source.html). You should also add the Go binary directory $GOROOT/bin to your shell's path.
For example, if you extracted the tar file into $HOME/go, you might put the following in your .profile:
export GOROOT=$HOME/go export PATH=$PATH:$GOROOT/bin
See https://golang.org/doc/install or doc/install.html for more details.