]> Cypherpunks repositories - gostls13.git/commitdiff
crypto: add BLAKE2b and BLAKE2s hash constants
authorAndreas Auernhammer <aead@mail.de>
Sun, 12 Feb 2017 20:41:29 +0000 (21:41 +0100)
committerAdam Langley <agl@golang.org>
Wed, 1 Mar 2017 19:26:16 +0000 (19:26 +0000)
Fixes golang/go#19060
Change-Id: I1844edc3dcccc8d83a11d1145b60b2b92f2658ca
Reviewed-on: https://go-review.googlesource.com/36876
Reviewed-by: Adam Langley <agl@golang.org>
src/crypto/crypto.go

index a80ebd36931eac75c9a841bd207edbf2b379df46..b4d6cdcab4e9b29144a06864172dc8ebc0f7242b 100644 (file)
@@ -21,40 +21,48 @@ func (h Hash) HashFunc() Hash {
 }
 
 const (
-       MD4        Hash = 1 + iota // import golang.org/x/crypto/md4
-       MD5                        // import crypto/md5
-       SHA1                       // import crypto/sha1
-       SHA224                     // import crypto/sha256
-       SHA256                     // import crypto/sha256
-       SHA384                     // import crypto/sha512
-       SHA512                     // import crypto/sha512
-       MD5SHA1                    // no implementation; MD5+SHA1 used for TLS RSA
-       RIPEMD160                  // import golang.org/x/crypto/ripemd160
-       SHA3_224                   // import golang.org/x/crypto/sha3
-       SHA3_256                   // import golang.org/x/crypto/sha3
-       SHA3_384                   // import golang.org/x/crypto/sha3
-       SHA3_512                   // import golang.org/x/crypto/sha3
-       SHA512_224                 // import crypto/sha512
-       SHA512_256                 // import crypto/sha512
+       MD4         Hash = 1 + iota // import golang.org/x/crypto/md4
+       MD5                         // import crypto/md5
+       SHA1                        // import crypto/sha1
+       SHA224                      // import crypto/sha256
+       SHA256                      // import crypto/sha256
+       SHA384                      // import crypto/sha512
+       SHA512                      // import crypto/sha512
+       MD5SHA1                     // no implementation; MD5+SHA1 used for TLS RSA
+       RIPEMD160                   // import golang.org/x/crypto/ripemd160
+       SHA3_224                    // import golang.org/x/crypto/sha3
+       SHA3_256                    // import golang.org/x/crypto/sha3
+       SHA3_384                    // import golang.org/x/crypto/sha3
+       SHA3_512                    // import golang.org/x/crypto/sha3
+       SHA512_224                  // import crypto/sha512
+       SHA512_256                  // import crypto/sha512
+       BLAKE2s_256                 // import golang.org/x/crypto/blake2s
+       BLAKE2b_256                 // import golang.org/x/crypto/blake2b
+       BLAKE2b_384                 // import golang.org/x/crypto/blake2b
+       BLAKE2b_512                 // import golang.org/x/crypto/blake2b
        maxHash
 )
 
 var digestSizes = []uint8{
-       MD4:        16,
-       MD5:        16,
-       SHA1:       20,
-       SHA224:     28,
-       SHA256:     32,
-       SHA384:     48,
-       SHA512:     64,
-       SHA512_224: 28,
-       SHA512_256: 32,
-       SHA3_224:   28,
-       SHA3_256:   32,
-       SHA3_384:   48,
-       SHA3_512:   64,
-       MD5SHA1:    36,
-       RIPEMD160:  20,
+       MD4:         16,
+       MD5:         16,
+       SHA1:        20,
+       SHA224:      28,
+       SHA256:      32,
+       SHA384:      48,
+       SHA512:      64,
+       SHA512_224:  28,
+       SHA512_256:  32,
+       SHA3_224:    28,
+       SHA3_256:    32,
+       SHA3_384:    48,
+       SHA3_512:    64,
+       MD5SHA1:     36,
+       RIPEMD160:   20,
+       BLAKE2s_256: 32,
+       BLAKE2b_256: 32,
+       BLAKE2b_384: 48,
+       BLAKE2b_512: 64,
 }
 
 // Size returns the length, in bytes, of a digest resulting from the given hash