add crypto sha1, sha256, sha512
This commit is contained in:
11
_cmptest/sha1demo/sha1.go
Normal file
11
_cmptest/sha1demo/sha1.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/sha1"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
data := []byte("This page intentionally left blank.")
|
||||
fmt.Printf("% x", sha1.Sum(data))
|
||||
}
|
||||
11
_cmptest/sha256demo/sha256.go
Normal file
11
_cmptest/sha256demo/sha256.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
sum := sha256.Sum256([]byte("hello world\n"))
|
||||
fmt.Printf("%x", sum)
|
||||
}
|
||||
11
_cmptest/sha512demo/sha512.go
Normal file
11
_cmptest/sha512demo/sha512.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/sha512"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
sum := sha512.Sum512([]byte("hello world\n"))
|
||||
fmt.Printf("%x", sum)
|
||||
}
|
||||
Reference in New Issue
Block a user