Sha1Sum calculates the SHA1 sum of a file.
(path string)
| 11 | |
| 12 | // Sha1Sum calculates the SHA1 sum of a file. |
| 13 | func Sha1Sum(path string) string { |
| 14 | f, err := os.Open(path) |
| 15 | Expect(err).ToNot(HaveOccurred()) |
| 16 | defer f.Close() |
| 17 | |
| 18 | hash := sha1.New() |
| 19 | _, err = io.Copy(hash, f) |
| 20 | Expect(err).ToNot(HaveOccurred()) |
| 21 | |
| 22 | return fmt.Sprintf("%x", hash.Sum(nil)) |
| 23 | } |
no test coverage detected