sha1

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

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