Repository: docker/notary (go)

Issue:
Fix `Sha256` naming
"SHA" is an acronym so following Go's coding standards should either be `sha` or `SHA` depending on whether it needs to be exported or not. `github.com/server/storage.TUFFile` at least has the naming wrong, a case sensitive grep may find other places.

Pull request description:
fixing Sha256 capitalization per Go rules on acronyms
Closes #1024 

Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)

Patch:
diff --git a/cmd/notary/keys.go b/cmd/notary/keys.go
index 7e89351b..ba38b7e8 100644
--- a/cmd/notary/keys.go
+++ b/cmd/notary/keys.go
@@ -328,7 +328,7 @@ func (k *keyCommander) keyRemove(cmd *cobra.Command, args []string) error {
 	keyID := args[0]
 
 	// This is an invalid ID
-	if len(keyID) != notary.Sha256HexSize {
+	if len(keyID) != notary.SHA256HexSize {
 		return fmt.Errorf("invalid key ID provided: %s", keyID)
 	}
 	cmd.Println("")
@@ -356,7 +356,7 @@ func (k *keyCommander) keyPassphraseChange(cmd *cobra.Command, args []string) er
 	keyID := args[0]
 
 	// This is an invalid ID
-	if len(keyID) != notary.Sha256HexSize {
+	if len(keyID) != notary.SHA256HexSize {
 		return fmt.Errorf("invalid key ID provided: %s", keyID)
 	}
 
diff --git a/cmd/notary/tuf.go b/cmd/notary/tuf.go
index 7666171b..2433a5c8 100644
--- a/cmd/notary/tuf.go
+++ b/cmd/notary/tuf.go
@@ -221,7 +221,7 @@ func getTargetHashes(t *tufCommander) (data.Hashes, error) {
 	targetHash := data.Hashes{}
 
 	if t.sha256 != "" {
-		if len(t.sha256) != notary.Sha256HexSize {
+		if len(t.sha256) != notary.SHA256HexSize {
 			return nil, fmt.Errorf("invalid sha256 hex contents provided")
 		}
 		sha256Hash, err := hex.DecodeString(t.sha256)
@@ -232,7 +232,7 @@ func getTargetHashes(t *tufCommander) (data.Hashes, error) {
 	}
 
 	if t.sha512 != "" {
-		if len(t.sha512) != notary.Sha512HexSize {
+		if len(t.sha512) != notary.SHA512HexSize {
 			return nil, fmt.Errorf("invalid sha512 hex contents provided")
 		}
 		sha512Hash, err := hex.DecodeString(t.sha512)
diff --git a/const.go b/const.go
index be301920..77853376 100644
--- a/const.go
+++ b/const.go
@@ -14,10 +14,10 @@ const (
 	MinRSABitSize = 2048
 	// MinThreshold requires a minimum of one threshold for roles; currently we do not support a higher threshold
 	MinThreshold = 1
-	// Sha256HexSize is how big a Sha256 hex is in number of characters
-	Sha256HexSize = 64
-	// Sha512HexSize is how big a Sha512 hex is in number of characters
-	Sha512HexSize = 128
+	// SHA256HexSize is how big a SHA256 hex is in number of characters
+	SHA256HexSize = 64
+	// SHA512HexSize is how big a SHA512 hex is in number of characters
+	SHA512HexSize = 128
 	// SHA256 is the name of SHA256 hash algorithm
 	SHA256 = "sha256"
 	// SHA512 is the name of SHA512 hash algorithm
diff --git a/server/handlers/roles.go b/server/handlers/roles.go
index 46f38dd2..99ebf842 100644
--- a/server/handlers/roles.go
+++ b/server/handlers/roles.go
@@ -88,9 +88,9 @@ func getMaybeServerSigned(ctx context.Context, store storage.MetaStore, gun, rol
 		if err != nil || snapshotChecksums == nil {
 			return nil, nil, fmt.Errorf("could not retrieve latest snapshot checksum")
 		}
-		if snapshotSha256Bytes, ok := snapshotChecksums.Hashes[notary.SHA256]; ok {
-			snapshotSha256Hex := hex.EncodeToString(snapshotSha256Bytes[:])
-			return store.GetChecksum(gun, role, snapshotSha256Hex)
+		if snapshotSHA256Bytes, ok := snapshotChecksums.Hashes[notary.SHA256]; ok {
+			snapshotSHA256Hex := hex.EncodeToString(snapshotSHA256Bytes[:])
+			return store.GetChecksum(gun, role, snapshotSHA256Hex)
 		}
 		return nil, nil, fmt.Errorf("could not retrieve sha256 snapshot checksum")
 	}
diff --git a/server/storage/rethinkdb.go b/server/storage/rethinkdb.go
index 267b1264..5462d6f2 100644
--- a/server/storage/rethinkdb.go
+++ b/server/storage/rethinkdb.go
@@ -22,7 +22,7 @@ type RDBTUFFile struct {
 	Gun            string        `gorethink:"gun"`
 	Role           string        `gorethink:"role"`
 	Version        int           `gorethink:"version"`
-	Sha256         string        `gorethink:"sha256"`
+	SHA256         string        `gorethink:"sha256"`
 	Data           []byte        `gorethink:"data"`
 	TSchecksum     string        `gorethink:"timestamp_checksum"`
 }
@@ -42,7 +42,7 @@ func rdbTUFFileFromJSON(data []byte) (interface{}, error) {
 		Gun        string    `json:"gun"`
 		Role       string    `json:"role"`
 		Version    int       `json:"version"`
-		Sha256     string    `json:"sha256"`
+		SHA256     string    `json:"sha256"`
 		Data       []byte    `json:"data"`
 		TSchecksum string    `json:"timestamp_checksum"`
 	}{}
@@ -59,7 +59,7 @@ func rdbTUFFileFromJSON(data []byte) (interface{}, error) {
 		Gun:            a.Gun,
 		Role:           a.Role,
 		Version:        a.Version,
-		Sha256:         a.Sha256,
+		SHA256:         a.SHA256,
 		Data:           a.Data,
 		TSchecksum:     a.TSchecksum,
 	}, nil
@@ -98,7 +98,7 @@ func (rdb RethinkDB) UpdateCurrent(gun string, update MetaUpdate) error {
 		Gun:            gun,
 		Role:           update.Role,
 		Version:        update.Version,
-		Sha256:         hex.EncodeToString(checksum[:]),
+		SHA256:         hex.EncodeToString(checksum[:]),
 		Data:           update.Data,
 	}
 	_, err := gorethink.DB(rdb.dbName).Table(file.TableName()).Insert(
@@ -127,7 +127,7 @@ func (rdb RethinkDB) UpdateCurrentWithTSChecksum(gun, tsChecksum string, update
 		Gun:            gun,
 		Role:           update.Role,
 		Version:        update.Version,
-		Sha256:         hex.EncodeToString(checksum[:]),
+		SHA256:         hex.EncodeToString(checksum[:]),
 		TSchecksum:     tsChecksum,
 		Data:           update.Data,
 	}
@@ -216,7 +216,7 @@ func (rdb RethinkDB) GetCurrent(gun, role string) (created *time.Time, data []by
 func (rdb RethinkDB) GetChecksum(gun, role, checksum string) (created *time.Time, data []byte, err error) {
 	var file RDBTUFFile
 	res, err := gorethink.DB(rdb.dbName).Table(file.TableName(), gorethink.TableOpts{ReadMode: "majority"}).GetAllByIndex(
-		rdbGunRoleSha256Idx, []string{gun, role, checksum},
+		rdbGunRoleSHA256Idx, []string{gun, role, checksum},
 	).Run(rdb.sess)
 	if err != nil {
 		return nil, nil, err
diff --git a/server/storage/rethinkdb_models.go b/server/storage/rethinkdb_models.go
index e9db28e4..1aac1914 100644
--- a/server/storage/rethinkdb_models.go
+++ b/server/storage/rethinkdb_models.go
@@ -6,9 +6,9 @@ import (
 
 // These consts are the index names we've defined for RethinkDB
 const (
-	rdbSha256Idx        = "sha256"
+	rdbSHA256Idx        = "sha256"
 	rdbGunRoleIdx       = "gun_role"
-	rdbGunRoleSha256Idx = "gun_role_sha256"
+	rdbGunRoleSHA256Idx = "gun_role_sha256"
 )
 
 var (
@@ -17,11 +17,11 @@ var (
 		Name:       RDBTUFFile{}.TableName(),
 		PrimaryKey: "gun_role_version",
 		SecondaryIndexes: map[string][]string{
-			rdbSha256Idx:         nil,
+			rdbSHA256Idx:         nil,
 			"gun":                nil,
 			"timestamp_checksum": nil,
 			rdbGunRoleIdx:        {"gun", "role"},
-			rdbGunRoleSha256Idx:  {"gun", "role", "sha256"},
+			rdbGunRoleSHA256Idx:  {"gun", "role", "sha256"},
 		},
 		// this configuration guarantees linearizability of individual atomic operations on individual documents
 		Config: map[string]string{
diff --git a/server/storage/sql_models.go b/server/storage/sql_models.go
index 9ba0ab77..50aec178 100644
--- a/server/storage/sql_models.go
+++ b/server/storage/sql_models.go
@@ -17,7 +17,7 @@ type TUFFile struct {
 	Gun     string `sql:"type:varchar(255);not null"`
 	Role    string `sql:"type:varchar(255);not null"`
 	Version int    `sql:"not null"`
-	Sha256  string `sql:"type:varchar(64);"`
+	SHA256  string `gorm:"column:sha256" sql:"type:varchar(64);"`
 	Data    []byte `sql:"type:longblob;not null"`
 }
 
diff --git a/server/storage/sqldb.go b/server/storage/sqldb.go
index a6cd08c2..a5dbd9b0 100644
--- a/server/storage/sqldb.go
+++ b/server/storage/sqldb.go
@@ -72,7 +72,7 @@ func (db *SQLStorage) UpdateCurrent(gun string, update MetaUpdate) error {
 			Gun:     gun,
 			Role:    update.Role,
 			Version: update.Version,
-			Sha256:  hexChecksum,
+			SHA256:  hexChecksum,
 			Data:    update.Data,
 		}).Error); err != nil {
 			return err
@@ -193,7 +193,7 @@ func (db *SQLStorage) GetChecksum(gun, tufRole, checksum string) (*time.Time, []
 		&TUFFile{
 			Gun:    gun,
 			Role:   tufRole,
-			Sha256: checksum,
+			SHA256: checksum,
 		},
 	).First(&row)
 	if err := isReadErr(q, row); err != nil {
diff --git a/server/storage/tuf_store.go b/server/storage/tuf_store.go
index 27ec38ea..7df28bce 100644
--- a/server/storage/tuf_store.go
+++ b/server/storage/tuf_store.go
@@ -52,26 +52,26 @@ func (tms TUFMetaStorage) GetCurrent(gun, tufRole string) (*time.Time, []byte, e
 	if err != nil || snapshotChecksums == nil {
 		return nil, nil, fmt.Errorf("could not retrieve latest snapshot checksum")
 	}
-	snapshotSha256Bytes, ok := snapshotChecksums.Hashes[notary.SHA256]
+	snapshotSHA256Bytes, ok := snapshotChecksums.Hashes[notary.SHA256]
 	if !ok {
 		return nil, nil, fmt.Errorf("could not retrieve latest snapshot sha256")
 	}
-	snapshotSha256Hex := hex.EncodeToString(snapshotSha256Bytes[:])
+	snapshotSHA256Hex := hex.EncodeToString(snapshotSHA256Bytes[:])
 
 	// Check the cache if we have our snapshot data
 	var snapshotTime *time.Time
 	var snapshotJSON []byte
-	if cachedSnapshotData, ok := tms.cachedMeta[snapshotSha256Hex]; ok {
+	if cachedSnapshotData, ok := tms.cachedMeta[snapshotSHA256Hex]; ok {
 		snapshotTime = cachedSnapshotData.createupdate
 		snapshotJSON = cachedSnapshotData.data
 	} else {
 		// Get the snapshot from the underlying store by checksum if it isn't cached yet
-		snapshotTime, snapshotJSON, err = tms.GetChecksum(gun, data.CanonicalSnapshotRole, snapshotSha256Hex)
+		snapshotTime, snapshotJSON, err = tms.GetChecksum(gun, data.CanonicalSnapshotRole, snapshotSHA256Hex)
 		if err != nil {
 			return nil, nil, err
 		}
 		// cache for subsequent lookups
-		tms.cachedMeta[snapshotSha256Hex] = &storedMeta{data: snapshotJSON, createupdate: snapshotTime}
+		tms.cachedMeta[snapshotSHA256Hex] = &storedMeta{data: snapshotJSON, createupdate: snapshotTime}
 	}
 	// If we wanted data for the snapshot role, we're done here
 	if tufRole == data.CanonicalSnapshotRole {
@@ -87,22 +87,22 @@ func (tms TUFMetaStorage) GetCurrent(gun, tufRole string) (*time.Time, []byte, e
 	if err != nil {
 		return nil, nil, err
 	}
-	roleSha256Bytes, ok := roleMeta.Hashes[notary.SHA256]
+	roleSHA256Bytes, ok := roleMeta.Hashes[notary.SHA256]
 	if !ok {
 		return nil, nil, fmt.Errorf("could not retrieve latest %s sha256", tufRole)
 	}
-	roleSha256Hex := hex.EncodeToString(roleSha256Bytes[:])
+	roleSHA256Hex := hex.EncodeToString(roleSHA256Bytes[:])
 	// check if we can retrieve this data from cache
-	if cachedRoleData, ok := tms.cachedMeta[roleSha256Hex]; ok {
+	if cachedRoleData, ok := tms.cachedMeta[roleSHA256Hex]; ok {
 		return cachedRoleData.createupdate, cachedRoleData.data, nil
 	}
 
-	roleTime, roleJSON, err := tms.MetaStore.GetChecksum(gun, tufRole, roleSha256Hex)
+	roleTime, roleJSON, err := tms.MetaStore.GetChecksum(gun, tufRole, roleSHA256Hex)
 	if err != nil {
 		return nil, nil, err
 	}
 	// cache for subsequent lookups
-	tms.cachedMeta[roleSha256Hex] = &storedMeta{data: roleJSON, createupdate: roleTime}
+	tms.cachedMeta[roleSHA256Hex] = &storedMeta{data: roleJSON, createupdate: roleTime}
 	return roleTime, roleJSON, nil
 }
 
diff --git a/server/timestamp/timestamp.go b/server/timestamp/timestamp.go
index 9a69804b..98eae59b 100644
--- a/server/timestamp/timestamp.go
+++ b/server/timestamp/timestamp.go
@@ -91,12 +91,12 @@ func GetOrCreateTimestamp(gun string, store storage.MetaStore, cryptoService sig
 	if err != nil || snapChecksums == nil {
 		return nil, nil, err
 	}
-	snapshotSha256Bytes, ok := snapChecksums.Hashes[notary.SHA256]
+	snapshotSHA256Bytes, ok := snapChecksums.Hashes[notary.SHA256]
 	if !ok {
 		return nil, nil, data.ErrMissingMeta{Role: data.CanonicalSnapshotRole}
 	}
-	snapshotSha256Hex := hex.EncodeToString(snapshotSha256Bytes[:])
-	snapshotTime, snapshot, err := snapshot.GetOrCreateSnapshot(gun, snapshotSha256Hex, store, cryptoService)
+	snapshotSHA256Hex := hex.EncodeToString(snapshotSHA256Bytes[:])
+	snapshotTime, snapshot, err := snapshot.GetOrCreateSnapshot(gun, snapshotSHA256Hex, store, cryptoService)
 	if err != nil {
 		logrus.Debug("Previous timestamp, but no valid snapshot for GUN ", gun)
 		return nil, nil, err
diff --git a/tuf/utils/utils.go b/tuf/utils/utils.go
index 08de644f..a13c1d99 100644
--- a/tuf/utils/utils.go
+++ b/tuf/utils/utils.go
@@ -100,9 +100,9 @@ func FindRoleIndex(rs []*data.Role, name string) int {
 // ConsistentName generates the appropriate HTTP URL path for the role,
 // based on whether the repo is marked as consistent. The RemoteStore
 // is responsible for adding file extensions.
-func ConsistentName(role string, hashSha256 []byte) string {
-	if len(hashSha256) > 0 {
-		hash := hex.EncodeToString(hashSha256)
+func ConsistentName(role string, hashSHA256 []byte) string {
+	if len(hashSHA256) > 0 {
+		hash := hex.EncodeToString(hashSHA256)
 		return fmt.Sprintf("%s.%s", role, hash)
 	}
 	return role


Test patch:
diff --git a/cmd/notary/integration_test.go b/cmd/notary/integration_test.go
index 07b59783..c66f6f49 100644
--- a/cmd/notary/integration_test.go
+++ b/cmd/notary/integration_test.go
@@ -410,7 +410,7 @@ func TestClientTUFAddByHashInteraction(t *testing.T) {
 
 	targetData := []byte{'a', 'b', 'c'}
 	target256Bytes := sha256.Sum256(targetData)
-	targetSha256Hex := hex.EncodeToString(target256Bytes[:])
+	targetSHA256Hex := hex.EncodeToString(target256Bytes[:])
 	target512Bytes := sha512.Sum512(targetData)
 	targetSha512Hex := hex.EncodeToString(target512Bytes[:])
 
@@ -430,7 +430,7 @@ func TestClientTUFAddByHashInteraction(t *testing.T) {
 	require.NoError(t, err)
 
 	// add a target just by sha256
-	_, err = runCommand(t, tempDir, "addhash", "gun", target1, "3", "--sha256", targetSha256Hex)
+	_, err = runCommand(t, tempDir, "addhash", "gun", target1, "3", "--sha256", targetSHA256Hex)
 	require.NoError(t, err)
 
 	// check status - see target
@@ -507,7 +507,7 @@ func TestClientTUFAddByHashInteraction(t *testing.T) {
 	require.NoError(t, err)
 
 	// add a target by sha256 and sha512
-	_, err = runCommand(t, tempDir, "addhash", "gun", target3, "3", "--sha256", targetSha256Hex, "--sha512", targetSha512Hex)
+	_, err = runCommand(t, tempDir, "addhash", "gun", target3, "3", "--sha256", targetSHA256Hex, "--sha512", targetSha512Hex)
 	require.NoError(t, err)
 
 	// check status - see target
@@ -2034,7 +2034,7 @@ func TestClientTUFAddByHashWithAutoPublish(t *testing.T) {
 
 	targetData := []byte{'a', 'b', 'c'}
 	target256Bytes := sha256.Sum256(targetData)
-	targetSha256Hex := hex.EncodeToString(target256Bytes[:])
+	targetSHA256Hex := hex.EncodeToString(target256Bytes[:])
 
 	err := ioutil.WriteFile(filepath.Join(tempDir, "tempfile"), targetData, 0644)
 	require.NoError(t, err)
@@ -2050,7 +2050,7 @@ func TestClientTUFAddByHashWithAutoPublish(t *testing.T) {
 	require.NoError(t, err)
 
 	// add a target just by sha256
-	_, err = runCommand(t, tempDir, "-s", server.URL, "addhash", "-p", "gun", target1, "3", "--sha256", targetSha256Hex)
+	_, err = runCommand(t, tempDir, "-s", server.URL, "addhash", "-p", "gun", target1, "3", "--sha256", targetSHA256Hex)
 	require.NoError(t, err)
 
 	// check status - no targets
diff --git a/cmd/notary/keys_test.go b/cmd/notary/keys_test.go
index eba06982..3189f591 100644
--- a/cmd/notary/keys_test.go
+++ b/cmd/notary/keys_test.go
@@ -531,7 +531,7 @@ func TestChangeKeyPassphraseNonexistentID(t *testing.T) {
 		getRetriever: func() notary.PassRetriever { return passphrase.ConstantRetriever("pass") },
 	}
 	// Valid ID size, but does not exist as a key ID
-	err := k.keyPassphraseChange(&cobra.Command{}, []string{strings.Repeat("x", notary.Sha256HexSize)})
+	err := k.keyPassphraseChange(&cobra.Command{}, []string{strings.Repeat("x", notary.SHA256HexSize)})
 	require.Error(t, err)
 	require.Contains(t, err.Error(), "could not retrieve local key for key ID provided")
 }
diff --git a/cmd/notary/main_test.go b/cmd/notary/main_test.go
index 3d8541ec..69c6faa7 100644
--- a/cmd/notary/main_test.go
+++ b/cmd/notary/main_test.go
@@ -472,7 +472,7 @@ func TestConfigFileTrustPinning(t *testing.T) {
 		        "repo3": ["%s"]
 		    }
 		 }
-	}`, strings.Repeat("x", notary.Sha256HexSize)))
+	}`, strings.Repeat("x", notary.SHA256HexSize)))
 	defer os.RemoveAll(tempDir)
 	commander = &notaryCommander{
 		getRetriever: func() notary.PassRetriever { return passphrase.ConstantRetriever("pass") },
@@ -481,10 +481,10 @@ func TestConfigFileTrustPinning(t *testing.T) {
 
 	config, err = commander.parseConfig()
 	require.NoError(t, err)
-	require.Equal(t, []interface{}{strings.Repeat("x", notary.Sha256HexSize)}, config.GetStringMap("trust_pinning.certs")["repo3"])
+	require.Equal(t, []interface{}{strings.Repeat("x", notary.SHA256HexSize)}, config.GetStringMap("trust_pinning.certs")["repo3"])
 	trustPin, err = getTrustPinning(config)
 	require.NoError(t, err)
-	require.Equal(t, strings.Repeat("x", notary.Sha256HexSize), trustPin.Certs["repo3"][0])
+	require.Equal(t, strings.Repeat("x", notary.SHA256HexSize), trustPin.Certs["repo3"][0])
 
 	// Check that an invalid cert ID pinning format fails
 	tempDir = tempDirWithConfig(t, fmt.Sprintf(`{
@@ -493,7 +493,7 @@ func TestConfigFileTrustPinning(t *testing.T) {
 		        "repo3": "%s"
 		    }
 		 }
-	}`, strings.Repeat("x", notary.Sha256HexSize)))
+	}`, strings.Repeat("x", notary.SHA256HexSize)))
 	defer os.RemoveAll(tempDir)
 	commander = &notaryCommander{
 		getRetriever: func() notary.PassRetriever { return passphrase.ConstantRetriever("pass") },
diff --git a/server/storage/rethinkdb_test.go b/server/storage/rethinkdb_test.go
index 0a084600..aaa5a1d8 100644
--- a/server/storage/rethinkdb_test.go
+++ b/server/storage/rethinkdb_test.go
@@ -57,7 +57,7 @@ func TestRDBTUFFileJSONUnmarshalling(t *testing.T) {
 		Gun:            "namespaced/name",
 		Role:           "timestamp",
 		Version:        5,
-		Sha256:         "56ee4a23129fc22c6cb4b4ba5f78d730c91ab6def514e80d807c947bb21f0d63",
+		SHA256:         "56ee4a23129fc22c6cb4b4ba5f78d730c91ab6def514e80d807c947bb21f0d63",
 		Data:           data,
 		TSchecksum:     "ebe6b6e082c94ef24043f1786a7046432506c3d193a47c299ed48ff4413ad7b0",
 	}
diff --git a/server/storage/sqldb_test.go b/server/storage/sqldb_test.go
index 6334a6d4..8ce22415 100644
--- a/server/storage/sqldb_test.go
+++ b/server/storage/sqldb_test.go
@@ -42,7 +42,7 @@ func assertExpectedGormTUFMeta(t *testing.T, expected []StoredTUFMeta, gormDB go
 			Gun:     tufObj.Gun,
 			Role:    tufObj.Role,
 			Version: tufObj.Version,
-			Sha256:  tufObj.Sha256,
+			SHA256:  tufObj.SHA256,
 			Data:    tufObj.Data,
 		}
 	}
diff --git a/server/storage/storage_test.go b/server/storage/storage_test.go
index da23075d..2050b358 100644
--- a/server/storage/storage_test.go
+++ b/server/storage/storage_test.go
@@ -14,7 +14,7 @@ import (
 type StoredTUFMeta struct {
 	Gun     string
 	Role    string
-	Sha256  string
+	SHA256  string
 	Data    []byte
 	Version int
 }
@@ -29,7 +29,7 @@ func SampleCustomTUFObj(gun, role string, version int, tufdata []byte) StoredTUF
 		Gun:     gun,
 		Role:    role,
 		Version: version,
-		Sha256:  hexChecksum,
+		SHA256:  hexChecksum,
 		Data:    tufdata,
 	}
 }
diff --git a/server/storage/tuf_store_test.go b/server/storage/tuf_store_test.go
index a5de6e07..d02920c4 100644
--- a/server/storage/tuf_store_test.go
+++ b/server/storage/tuf_store_test.go
@@ -46,7 +46,7 @@ func testTUFMetaStoreGetCurrent(t *testing.T, s MetaStore) {
 	ConsistentMissingTSAndSnapGetCurrentTest(t, tufDBStore, initialRootTUF)
 
 	// Note that get by checksum succeeds, since it does not try to walk timestamp/snapshot
-	_, _, err := tufDBStore.GetChecksum(gun, data.CanonicalRootRole, initialRootTUF.Sha256)
+	_, _, err := tufDBStore.GetChecksum(gun, data.CanonicalRootRole, initialRootTUF.SHA256)
 	require.NoError(t, err)
 
 	// Now add metadata from a valid TUF repo to ensure that we walk correctly.
diff --git a/trustmanager/keystore_test.go b/trustmanager/keystore_test.go
index 2f76bf01..678a4141 100644
--- a/trustmanager/keystore_test.go
+++ b/trustmanager/keystore_test.go
@@ -113,7 +113,7 @@ func TestKeyStoreInternalState(t *testing.T) {
 	for _, role := range roles {
 		keyID, _ := roleToID[role]
 		// make sure this keyID is the right length
-		require.Len(t, keyID, notary.Sha256HexSize)
+		require.Len(t, keyID, notary.SHA256HexSize)
 		require.Equal(t, role, store.keyInfoMap[keyID].Role)
 		// targets and snapshot keys should have a gun set, root and delegation keys should not
 		if role == data.CanonicalTargetsRole || role == data.CanonicalSnapshotRole {
diff --git a/tuf/data/types_test.go b/tuf/data/types_test.go
index 73bc402c..8e8089b9 100644
--- a/tuf/data/types_test.go
+++ b/tuf/data/types_test.go
@@ -230,7 +230,7 @@ func TestCompareMultiHashes(t *testing.T) {
 	require.NoError(t, err)
 
 	// change the sha512 for hashes2, comparison will now fail
-	hashes2[notary.SHA512], err = hex.DecodeString(strings.Repeat("a", notary.Sha512HexSize))
+	hashes2[notary.SHA512], err = hex.DecodeString(strings.Repeat("a", notary.SHA512HexSize))
 	require.NoError(t, err)
 	err = CompareMultiHashes(hashes1, hashes2)
 	require.Error(t, err)