package utils import ( "bufio" "crypto/sha256" "fmt" "io" "log" "os" ) func HashFileCompare(path string, fingerPrint string) bool { f, err := os.Open(path) if err != nil { log.Fatal(err) } defer f.Close() input := bufio.NewReader(f) hash := sha256.New() if _, err := io.Copy(hash, input); err != nil { log.Fatal(err) } sum := hash.Sum(nil) fmt.Printf("%x\n", sum) println(fingerPrint, fmt.Sprintf("%x", sum)) return fingerPrint == fmt.Sprintf("%x", sum) }