Commit graph

10 commits

Author SHA1 Message Date
Josh Rickmar
0d01bb9cb9 Optimize NewShaHashFromStr. 2015-01-06 20:04:33 -05:00
Josh Rickmar
df3469a792 Improve ShaHash.String comment and implementation.
The hash is not displayed big endian, but rather as a byte-reversed
hash as a hexidecimal string, so document it as such.

While here, speed up the function.  Some benchmarks:

BenchmarkShaHashString   2000000               996 ns/op
BenchmarkShaHashStringOld         100000             22701 ns/op
2015-01-05 17:18:25 -05:00
Josh Rickmar
0127b3aafe Make ErrHashStrSize slightly more descriptive.
Add the word 'string' to the error string so if this is printed, it
will be clearer that it was a hash string decode that failed (as
opposed to other errors creating a ShaHash from a byte slice) and
change 'chars' to 'bytes', since the string length is measured in
bytes, not UTF-8 code points.

ok @davecgh
2014-09-12 08:44:15 -05:00
Dave Collins
2cc89bbf5b Remove function name from ShaHash error message.
This makes golint happy.
2014-04-21 10:53:22 -05:00
Dave Collins
6c7f45fdb7 Add 2014 to copyright dates. 2014-01-08 23:44:08 -06:00
Dave Collins
dd41f7e91a Minor cleanup.
This commit fixes a couple of comments and cleans up a couple of things
golint complained about.
2013-11-07 06:21:44 -06:00
Dave Collins
035a9c3dc3 Add several comments for exported constants. 2013-07-27 16:31:47 -05:00
mischief
7630a95724 fix Stringer interface for ShaHash.
http://golang.org/ref/spec#Method_sets for why this is necessary
2013-05-29 11:51:13 -07:00
Dave Collins
d829f688b9 Fix comment typo. 2013-05-09 18:12:11 -05:00
Dave Collins
69b27dd5d3 Initial implementation. 2013-05-08 18:58:29 -05:00