February 2018
Intermediate to advanced
340 pages
9h 43m
English
This is content to check
package main import ( "crypto/md5" "fmt" "io" "os" ) var content = "This is content to check" func main() { checksum := MD5(content) checksum2 := FileMD5("content.dat") fmt.Printf("Checksum 1: %s\n", checksum) fmt.Printf("Checksum 2: %s\n", checksum2) if checksum == checksum2 { fmt.Println("Content matches!!!") } } // MD5 creates the md5 // hash for given content encoded in // hex string func MD5(data string) string { h := md5.Sum([]byte(data)) return fmt.Sprintf("%x", h) } // FileMD5 creates hex ...Read now
Unlock full access