mirror of
https://github.com/Estom/notes.git
synced 2026-05-02 06:24:15 +08:00
go知识重新整理
This commit is contained in:
13
Go/gopkg/crypto/md5.go
Normal file
13
Go/gopkg/crypto/md5.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"io"
|
||||
)
|
||||
|
||||
func main() {
|
||||
h := md5.New()
|
||||
io.WriteString(h, "demo")
|
||||
fmt.Printf("%x\n", h.Sum(nil)) // New() Sum()
|
||||
}
|
||||
13
Go/gopkg/crypto/sha256.go
Normal file
13
Go/gopkg/crypto/sha256.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
"io"
|
||||
)
|
||||
|
||||
func main() {
|
||||
h := sha256.New()
|
||||
io.WriteString(h, "demo")
|
||||
fmt.Printf("%x\n", h.Sum(nil))
|
||||
}
|
||||
Reference in New Issue
Block a user