mirror of
https://github.com/JaCoB1123/dupe-finder.git
synced 2025-05-18 06:01:56 +02:00
Initial
This commit is contained in:
commit
ccb42c7e29
BIN
dupe-finder.exe
Normal file
BIN
dupe-finder.exe
Normal file
Binary file not shown.
40
main.go
Normal file
40
main.go
Normal file
@ -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
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user