Standard library / crypto/sha1
crypto/sha1.Sum()
Compute the SHA1 digest of a complete byte slice. Cryptographically broken for collision resistance; use only for unavoidable legacy compatibility, never new signatures or adversarial integrity checks. Expected stdout: 'a9993e364706816aba3e25717850c26c9cd0d89d\n'.
Formal Syntax & Structure
go syntaxgo
func Sum(data []byte) [Size]byteParameters & Attributes
| Name | Type | Description |
|---|---|---|
| data | []byte | Exact input bytes to hash. |
Return Value
[Size]byte
Fixed-size SHA1 digest.
Working Example
Example Snippetgo
package main
import ( "crypto/sha1" "fmt")
func main() { fmt.Printf("%x\n", sha1.Sum([]byte("abc"))) }