Skip to content

Commit 395a0ac

Browse files
authored
Use sha256 in test (#268)
Some aggressive dependency checks flag the use of md5. Switch to sha256 as it accomplishes the same purpose.
1 parent 402949e commit 395a0ac

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

cmp/compare_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package cmp_test
66

77
import (
88
"bytes"
9-
"crypto/md5"
9+
"crypto/sha256"
1010
"encoding/json"
1111
"errors"
1212
"flag"
@@ -476,8 +476,8 @@ func comparerTests() []test {
476476
reason: "comparer for fmt.Stringer used to compare differing types with different strings",
477477
}, {
478478
label: label + "/DifferingHash",
479-
x: md5.Sum([]byte{'a'}),
480-
y: md5.Sum([]byte{'b'}),
479+
x: sha256.Sum256([]byte{'a'}),
480+
y: sha256.Sum256([]byte{'b'}),
481481
wantEqual: false,
482482
reason: "hash differs",
483483
}, {

cmp/testdata/diffs

+5-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@
3838
)
3939
>>> TestDiff/Comparer/StringerInequal
4040
<<< TestDiff/Comparer/DifferingHash
41-
[16]uint8{
42-
- 0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8, 0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61,
43-
+ 0x92, 0xeb, 0x5f, 0xfe, 0xe6, 0xae, 0x2f, 0xec, 0x3a, 0xd7, 0x1c, 0x77, 0x75, 0x31, 0x57, 0x8f,
41+
[32]uint8{
42+
- 0xca, 0x97, 0x81, 0x12, 0xca, 0x1b, 0xbd, 0xca, 0xfa, 0xc2, 0x31, 0xb3, 0x9a, 0x23, 0xdc, 0x4d,
43+
- 0xa7, 0x86, 0xef, 0xf8, 0x14, 0x7c, 0x4e, 0x72, 0xb9, 0x80, 0x77, 0x85, 0xaf, 0xee, 0x48, 0xbb,
44+
+ 0x3e, 0x23, 0xe8, 0x16, 0x00, 0x39, 0x59, 0x4a, 0x33, 0x89, 0x4f, 0x65, 0x64, 0xe1, 0xb1, 0x34,
45+
+ 0x8b, 0xbd, 0x7a, 0x00, 0x88, 0xd4, 0x2c, 0x4a, 0xcb, 0x73, 0xee, 0xae, 0xd5, 0x9c, 0x00, 0x9d,
4446
}
4547
>>> TestDiff/Comparer/DifferingHash
4648
<<< TestDiff/Comparer/NilStringer

0 commit comments

Comments
 (0)