Skip to content

Commit

Permalink
Use sha256 in test (#268)
Browse files Browse the repository at this point in the history
Some aggressive dependency checks flag the use of md5.
Switch to sha256 as it accomplishes the same purpose.
  • Loading branch information
dsnet committed Jul 22, 2021
1 parent 402949e commit 395a0ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions cmp/compare_test.go
Expand Up @@ -6,7 +6,7 @@ package cmp_test

import (
"bytes"
"crypto/md5"
"crypto/sha256"
"encoding/json"
"errors"
"flag"
Expand Down Expand Up @@ -476,8 +476,8 @@ func comparerTests() []test {
reason: "comparer for fmt.Stringer used to compare differing types with different strings",
}, {
label: label + "/DifferingHash",
x: md5.Sum([]byte{'a'}),
y: md5.Sum([]byte{'b'}),
x: sha256.Sum256([]byte{'a'}),
y: sha256.Sum256([]byte{'b'}),
wantEqual: false,
reason: "hash differs",
}, {
Expand Down
8 changes: 5 additions & 3 deletions cmp/testdata/diffs
Expand Up @@ -38,9 +38,11 @@
)
>>> TestDiff/Comparer/StringerInequal
<<< TestDiff/Comparer/DifferingHash
[16]uint8{
- 0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8, 0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61,
+ 0x92, 0xeb, 0x5f, 0xfe, 0xe6, 0xae, 0x2f, 0xec, 0x3a, 0xd7, 0x1c, 0x77, 0x75, 0x31, 0x57, 0x8f,
[32]uint8{
- 0xca, 0x97, 0x81, 0x12, 0xca, 0x1b, 0xbd, 0xca, 0xfa, 0xc2, 0x31, 0xb3, 0x9a, 0x23, 0xdc, 0x4d,
- 0xa7, 0x86, 0xef, 0xf8, 0x14, 0x7c, 0x4e, 0x72, 0xb9, 0x80, 0x77, 0x85, 0xaf, 0xee, 0x48, 0xbb,
+ 0x3e, 0x23, 0xe8, 0x16, 0x00, 0x39, 0x59, 0x4a, 0x33, 0x89, 0x4f, 0x65, 0x64, 0xe1, 0xb1, 0x34,
+ 0x8b, 0xbd, 0x7a, 0x00, 0x88, 0xd4, 0x2c, 0x4a, 0xcb, 0x73, 0xee, 0xae, 0xd5, 0x9c, 0x00, 0x9d,
}
>>> TestDiff/Comparer/DifferingHash
<<< TestDiff/Comparer/NilStringer
Expand Down

0 comments on commit 395a0ac

Please sign in to comment.