sha256

最后更新于:2022-04-02 02:42:59

[TOC] ## 三种方式 ``` fmt.Printf("%x\n", sha256.Sum256([]byte("123"))) // a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3 hash := sha256.New() hash.Write([]byte("123")) fmt.Printf("%x\n", hash.Sum(nil)) // a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3 fmt.Printf("%s\n", hex.EncodeToString(hash.Sum(nil))) // a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3 ```
';