func CalcStrong(dir Dir) string {
	var sha1 = sha1.New()
	sha1.Write(reprDir(dir))
	return toHexString(sha1)
}
Calculate the strong checksum of a directory.
package fs
import (
	"bytes"
	"crypto/sha1"
	"fmt"
	"path/filepath"
)
const BLOCKSIZE int = 8192
type Node interface {
	Repo() NodeRepo
	Parent() (FsNode, bool)
}
type FsNode interface {
	Node
	Name() string
	Mode() uint32
}
func RelPath(item FsNode) string {
	parts := []string{}
	for fsNode, hasParent := item, true; hasParent; fsNode, hasParent = fsNode.Parent() {
		parts = append([]string{fsNode.Name()}, parts...)
	}
	return filepath.Join(parts...)
}
type Block interface {
	Node
	Info() *BlockInfo
}
type BlockInfo struct {
	Position int
	Weak     int
	Strong   string
	Parent   string
}
func (block *BlockInfo) Offset() int64 {
	return int64(block.Position) * int64(BLOCKSIZE)
}
type Blocks struct {
	Contents []Block
}
func (blocks *Blocks) Len() int {
	return len(blocks.Contents)
}
func (blocks *Blocks) Less(i, j int) bool {
	return blocks.Contents[i].Info().Position < blocks.Contents[j].Info().Position
}
func (blocks *Blocks) Swap(i, j int) {
	blocks.Contents[i], blocks.Contents[j] = blocks.Contents[j], blocks.Contents[i]
}
type File interface {
	FsNode
	Info() *FileInfo
	Blocks() []Block
}
type FileInfo struct {
	Name   string
	Mode   uint32  
	Size   int64
	Strong string
	Parent string
}
type Files struct {
	Contents []File
}
func (files *Files) Len() int {
	return len(files.Contents)
}
func (files *Files) Less(i, j int) bool {
	return files.Contents[i].Name() < files.Contents[j].Name()
}
func (files *Files) Swap(i, j int) {
	files.Contents[i], files.Contents[j] = files.Contents[j], files.Contents[i]
}
type Dir interface {
	FsNode
	Info() *DirInfo
	SubDirs() []Dir
	Files() []File
	UpdateStrong() string
}
type DirInfo struct {
	Name   string
	Mode   uint32
	Strong string
	Parent string
}
type Dirs struct {
	Contents []Dir
}
func (dirs *Dirs) Len() int {
	return len(dirs.Contents)
}
func (dirs *Dirs) Less(i, j int) bool {
	return dirs.Contents[i].Name() < dirs.Contents[j].Name()
}
func (dirs *Dirs) Swap(i, j int) {
	dirs.Contents[i], dirs.Contents[j] = dirs.Contents[j], dirs.Contents[i]
}