Documentation ¶
Overview ¶
Package sha256 implements the SHA224 and SHA256 hash algorithms as defined in FIPS 180-2.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Digest ¶
Digest calculates the SHA-256 digest and returns the resulting slice.
Example ¶
package main import ( "fmt" "gopkg.in/goyy/goyy.v0/util/crypto/sha256" ) func main() { dst, _ := sha256.Digest([]byte("goyy")) fmt.Println(fmt.Sprintf("%x", dst)) }
Output: 294d5a5ab822caec5c8ef8db496a44a5f185d83feb0699ab69e79b51166a1116
func DigestHex ¶
DigestHex calculates the SHA-256 digest and returns the resulting hex string.
Example ¶
package main import ( "fmt" "gopkg.in/goyy/goyy.v0/util/crypto/sha256" ) func main() { dst, _ := sha256.DigestHex("goyy") fmt.Println(dst) }
Output: 294d5a5ab822caec5c8ef8db496a44a5f185d83feb0699ab69e79b51166a1116
func DigestSum ¶
DigestSum calculates the SHA-256 digest to sum and returns the resulting slice.
Example ¶
package main import ( "fmt" "gopkg.in/goyy/goyy.v0/util/crypto/sha256" ) func main() { dst, _ := sha256.DigestSum([]byte("goyy"), []byte("goyy:")) fmt.Println(fmt.Sprintf("%x", dst)) }
Output: 676f79793a294d5a5ab822caec5c8ef8db496a44a5f185d83feb0699ab69e79b51166a1116
func DigestSumHex ¶
DigestSumHex calculates the SHA-256 digest to sum and returns the resulting hex string.
Example ¶
package main import ( "fmt" "gopkg.in/goyy/goyy.v0/util/crypto/sha256" ) func main() { dst, _ := sha256.DigestSumHex("goyy", "goyy:") fmt.Println(dst) }
Output: 676f79793a294d5a5ab822caec5c8ef8db496a44a5f185d83feb0699ab69e79b51166a1116
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.