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

Side by Side Diff: src/pkg/crypto/hmac/hmac_test.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
Left:
Right:
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 unified diff | Download patch
« no previous file with comments | « src/pkg/crypto/hmac/hmac.go ('k') | src/pkg/crypto/md4/md4.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package hmac 5 package hmac
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "hash" 9 "hash"
10 "testing" 10 "testing"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 h := tt.hash(tt.key) 185 h := tt.hash(tt.key)
186 for j := 0; j < 2; j++ { 186 for j := 0; j < 2; j++ {
187 n, err := h.Write(tt.in) 187 n, err := h.Write(tt.in)
188 if n != len(tt.in) || err != nil { 188 if n != len(tt.in) || err != nil {
189 t.Errorf("test %d.%d: Write(%d) = %d, %v", i, j, len(tt.in), n, err) 189 t.Errorf("test %d.%d: Write(%d) = %d, %v", i, j, len(tt.in), n, err)
190 continue 190 continue
191 } 191 }
192 192
193 // Repetitive Sum() calls should return the same value 193 // Repetitive Sum() calls should return the same value
194 for k := 0; k < 2; k++ { 194 for k := 0; k < 2; k++ {
195 » » » » sum := fmt.Sprintf("%x", h.Sum()) 195 » » » » sum := fmt.Sprintf("%x", h.Sum(nil))
196 if sum != tt.out { 196 if sum != tt.out {
197 t.Errorf("test %d.%d.%d: have %s want %s \n", i, j, k, sum, tt.out) 197 t.Errorf("test %d.%d.%d: have %s want %s \n", i, j, k, sum, tt.out)
198 } 198 }
199 } 199 }
200 200
201 // Second iteration: make sure reset works. 201 // Second iteration: make sure reset works.
202 h.Reset() 202 h.Reset()
203 } 203 }
204 } 204 }
205 } 205 }
OLDNEW
« no previous file with comments | « src/pkg/crypto/hmac/hmac.go ('k') | src/pkg/crypto/md4/md4.go » ('j') | no next file with comments »

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