summaryrefslogtreecommitdiff
path: root/src/pkg/crypto/sha1/sha1.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/crypto/sha1/sha1.go')
-rw-r--r--src/pkg/crypto/sha1/sha1.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/pkg/crypto/sha1/sha1.go b/src/pkg/crypto/sha1/sha1.go
index 8eb3f7a79..9f1a96e36 100644
--- a/src/pkg/crypto/sha1/sha1.go
+++ b/src/pkg/crypto/sha1/sha1.go
@@ -62,16 +62,10 @@ func (d *digest) Write(p []byte) (nn int, err error) {
nn = len(p)
d.len += uint64(nn)
if d.nx > 0 {
- n := len(p)
- if n > chunk-d.nx {
- n = chunk - d.nx
- }
- for i := 0; i < n; i++ {
- d.x[d.nx+i] = p[i]
- }
+ n := copy(d.x[d.nx:], p)
d.nx += n
if d.nx == chunk {
- block(d, d.x[0:])
+ block(d, d.x[:])
d.nx = 0
}
p = p[n:]