Skip to content

Instantly share code, notes, and snippets.

@TripleDogDare
Last active August 23, 2017 04:17
Show Gist options
  • Save TripleDogDare/38b64dac32ba4dbc9a216f6fbab37cbc to your computer and use it in GitHub Desktop.
Save TripleDogDare/38b64dac32ba4dbc9a216f6fbab37cbc to your computer and use it in GitHub Desktop.
golang notes
  1. hash.Sum([]byte{}) does not do what I expected it to do. It prefixes the output with those bytes. I expected it to use it as a suffix for the hashing algorithm, but without actually affecting the underlying hash data. i.e. hash.Sum([]byte("foobar") -> "foobar<hash(written bytes)>" instead of "<hash(written bytes + "foobar">" https://play.golang.org/p/eCeUTlFCx4 Rereading the docs this makes sense now. But probably could use some additional examples.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment