From d4de8d07bfe6966a0a926d6afbc2beecec6d908d Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 22 Jul 2021 15:59:07 -0700 Subject: [PATCH] Use sha256 in test Some aggressive dependency checks flag the use of md5. Switch to sha256 as it accomplishes the same purpose. --- cmp/compare_test.go | 6 +++--- cmp/testdata/diffs | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cmp/compare_test.go b/cmp/compare_test.go index a435209..5cdce37 100644 --- a/cmp/compare_test.go +++ b/cmp/compare_test.go @@ -6,7 +6,7 @@ package cmp_test import ( "bytes" - "crypto/md5" + "crypto/sha256" "encoding/json" "errors" "flag" @@ -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", }, { diff --git a/cmp/testdata/diffs b/cmp/testdata/diffs index 96ea191..afc7366 100644 --- a/cmp/testdata/diffs +++ b/cmp/testdata/diffs @@ -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