commit ccb42c7e297a606d16a4143a749b38087340df2b Author: Jan Bader Date: Sat Nov 21 17:51:00 2020 +0100 Initial diff --git a/dupe-finder.exe b/dupe-finder.exe new file mode 100644 index 0000000..ce62fe8 Binary files /dev/null and b/dupe-finder.exe differ diff --git a/main.go b/main.go new file mode 100644 index 0000000..2b337e9 --- /dev/null +++ b/main.go @@ -0,0 +1,40 @@ +package main + +import ( + "crypto/sha256" + "encoding/base64" + "fmt" + "io" + "os" +) + +func main() { + for _, path := range os.Args[1:] { + fmt.Println(path) + } + +} + +type filesMap struct { + Files map[int]map[[32]byte]*fileEntry +} + +type fileEntry struct { + Path string + Size int +} + +func calculateHash(path string) (string, error) { + f, err := os.Open(path) + if err != nil { + return "", err + } + defer f.Close() + + h := sha256.New() + if _, err := io.Copy(h, f); err != nil { + return "", err + } + + return base64.RawStdEncoding.EncodeToString(h.Sum(nil)), nil +}