var DefaultHash … type Hash … // Hash1 is the "h1:" directory hash function, using SHA-256. // // Hash1 is "h1:" followed by the base64-encoded SHA-256 hash of a summary // prepared as if by the Unix command: // // sha256sum $(find . -type f | sort) | sha256sum // // More precisely, the hashed summary contains a single line for each file in the list, // ordered by sort.Strings applied to the file names, where each line consists of // the hexadecimal SHA-256 hash of the file content, // two spaces (U+0020), the file name, and a newline (U+000A). // // File names with newlines (U+000A) are disallowed. func Hash1(files []string, open func(string) (io.ReadCloser, error)) (string, error) { … } // HashDir returns the hash of the local file system directory dir, // replacing the directory name itself with prefix in the file names // used in the hash function. func HashDir(dir, prefix string, hash Hash) (string, error) { … } // DirFiles returns the list of files in the tree rooted at dir, // replacing the directory name dir with prefix in each name. // The resulting names always use forward slashes. func DirFiles(dir, prefix string) ([]string, error) { … } // HashZip returns the hash of the file content in the named zip file. // Only the file names and their contents are included in the hash: // the exact zip file format encoding, compression method, // per-file modification times, and other metadata are ignored. func HashZip(zipfile string, hash Hash) (string, error) { … }