File: digests.go

package info (click to toggle)
coyim 0.3.7-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,064 kB
  • ctags: 4,528
  • sloc: xml: 5,120; sh: 328; python: 286; makefile: 235; ruby: 51
file content (29 lines) | stat: -rw-r--r-- 460 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package digests

import (
	"crypto/sha1"
	"crypto/sha256"

	"golang.org/x/crypto/sha3"
)

// Sha1 will generate a SHA1 digest
func Sha1(i []byte) []byte {
	h := sha1.New()
	h.Write(i)
	return h.Sum(nil)
}

// Sha256 will generate a SHA256 digest
func Sha256(i []byte) []byte {
	h := sha256.New()
	h.Write(i)
	return h.Sum(nil)
}

// Sha3_256 will generate a SHA3-256 digest
func Sha3_256(i []byte) []byte {
	h := sha3.New256()
	h.Write(i)
	return h.Sum(nil)
}