hashFile returns the SHA-256 hash of a file on disk.
(path string)
| 193 | |
| 194 | // hashFile returns the SHA-256 hash of a file on disk. |
| 195 | func hashFile(path string) ([]byte, error) { |
| 196 | file, err := os.Open(path) |
| 197 | if err != nil { |
| 198 | return nil, err |
| 199 | } |
| 200 | defer file.Close() |
| 201 | h := sha256.New() |
| 202 | if _, err := io.Copy(h, file); err != nil { |
| 203 | return nil, err |
| 204 | } |
| 205 | return h.Sum(nil), nil |
| 206 | } |
searching dependent graphs…