Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2984)

Unified Diff: src/pkg/crypto/md4/md4.go

Issue 5448065: code review 5448065: Add a []byte argument to hash.Hash to allow an allocati... (Closed)
Patch Set: diff -r 5ef46981bf5e https://go.googlecode.com/hg/ Created 13 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pkg/crypto/hmac/hmac_test.go ('k') | src/pkg/crypto/md4/md4_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/crypto/md4/md4.go
===================================================================
--- a/src/pkg/crypto/md4/md4.go
+++ b/src/pkg/crypto/md4/md4.go
@@ -77,7 +77,7 @@
return
}
-func (d0 *digest) Sum() []byte {
+func (d0 *digest) Sum(in []byte) []byte {
// Make a copy of d0, so that caller can keep writing and summing.
d := new(digest)
*d = *d0
@@ -103,14 +103,11 @@
panic("d.nx != 0")
}
- p := make([]byte, 16)
- j := 0
for _, s := range d.s {
- p[j+0] = byte(s >> 0)
- p[j+1] = byte(s >> 8)
- p[j+2] = byte(s >> 16)
- p[j+3] = byte(s >> 24)
- j += 4
+ in = append(in, byte(s>>0))
+ in = append(in, byte(s>>8))
+ in = append(in, byte(s>>16))
+ in = append(in, byte(s>>24))
}
- return p
+ return in
}
« no previous file with comments | « src/pkg/crypto/hmac/hmac_test.go ('k') | src/pkg/crypto/md4/md4_test.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b