SHA256Streams 对文件流执行SHA256运算
(streams []io.Reader)
| 33 | |
| 34 | // SHA256Streams 对文件流执行SHA256运算 |
| 35 | func SHA256Streams(streams []io.Reader) ([]byte, error) { |
| 36 | hash := sha256.New() |
| 37 | for _, stream := range streams { |
| 38 | if _, err := io.Copy(hash, stream); err != nil { |
| 39 | return nil, err |
| 40 | } |
| 41 | } |
| 42 | ret := hash.Sum(nil) |
| 43 | //hex.EncodeToString(ret) |
| 44 | return ret, nil |
| 45 | } |
| 46 | |
| 47 | // RSA2048SignString 对文本执行RSA2048运算 |
| 48 | func RSA2048SignString(body string, privateKey *rsa.PrivateKey) ([]byte, error) { |
no outgoing calls
no test coverage detected