diff --git a/webcrypto/algorithm.go b/webcrypto/algorithm.go index a5b0ddc..065de20 100644 --- a/webcrypto/algorithm.go +++ b/webcrypto/algorithm.go @@ -60,17 +60,17 @@ const ( type HashAlgorithmIdentifier = AlgorithmIdentifier const ( - // Sha1 represents the SHA-1 algorithm. - Sha1 HashAlgorithmIdentifier = "SHA-1" + // SHA1 represents the SHA-1 algorithm. + SHA1 HashAlgorithmIdentifier = "SHA-1" - // Sha256 represents the SHA-256 algorithm. - Sha256 = "SHA-256" + // SHA256 represents the SHA-256 algorithm. + SHA256 = "SHA-256" - // Sha384 represents the SHA-384 algorithm. - Sha384 = "SHA-384" + // SHA384 represents the SHA-384 algorithm. + SHA384 = "SHA-384" - // Sha512 represents the SHA-512 algorithm. - Sha512 = "SHA-512" + // SHA512 represents the SHA-512 algorithm. + SHA512 = "SHA-512" ) // OperationIdentifier represents the name of an operation. @@ -185,5 +185,5 @@ func isAesAlgorithm(algorithmName string) bool { } func isHashAlgorithm(algorithmName string) bool { - return algorithmName == Sha1 || algorithmName == Sha256 || algorithmName == Sha384 || algorithmName == Sha512 + return algorithmName == SHA1 || algorithmName == SHA256 || algorithmName == SHA384 || algorithmName == SHA512 } diff --git a/webcrypto/hash.go b/webcrypto/hash.go index 911af7f..cedd4f1 100644 --- a/webcrypto/hash.go +++ b/webcrypto/hash.go @@ -11,13 +11,13 @@ import ( // hash.Hash instance. func getHashFn(name string) (func() hash.Hash, bool) { switch name { - case Sha1: + case SHA1: return crypto.SHA1.New, true - case Sha256: + case SHA256: return crypto.SHA256.New, true - case Sha384: + case SHA384: return crypto.SHA384.New, true - case Sha512: + case SHA512: return crypto.SHA512.New, true default: return nil, false diff --git a/webcrypto/hmac.go b/webcrypto/hmac.go index f3ce684..cb2322c 100644 --- a/webcrypto/hmac.go +++ b/webcrypto/hmac.go @@ -99,13 +99,13 @@ func (hkgp *HMACKeyGenParams) GenerateKey( // callback below could lead to a race condition. if !hkgp.Length.Valid { switch hkgp.Hash.Name { - case Sha1: + case SHA1: hkgp.Length = null.IntFrom(sha1.BlockSize * 8) - case Sha256: + case SHA256: hkgp.Length = null.IntFrom(sha256.BlockSize * 8) - case Sha384: + case SHA384: hkgp.Length = null.IntFrom(sha512.BlockSize * 8) - case Sha512: + case SHA512: hkgp.Length = null.IntFrom(sha512.BlockSize * 8) default: // This case should never happen, as the normalization algorithm