func main() { fmt.Println("This program benchmarks crypto/sha256 and aes/sha256 implementations") h := sha256.New() bench_sha256(&h, "crypto/sha256") ssl := sslSha256.New() bench_sha256(&ssl, "ssl/aes") }
func main() { fmt.Println("This program benchmarks crypto/sha256 and aes/sha256 implementations") h := sha256.New() bench_sha256(&h, "crypto/sha256") c := gosslSHA256.New() bench_sha256(&c, "gossl/sha256") }
func main() { flag.Parse() for _, fname := range flag.Args() { h := sha256.New() buf := make([]byte, 1024*8) //reasonable default blocksize file, err := os.Open(fname) if err != nil { panic(err) } for { bytesread, err := file.Read(buf) if err != nil && err != io.EOF { panic(err) } if err == io.EOF { break } h.Write(buf[0:bytesread]) } fmt.Printf("%x %s\n", h.Sum(nil), fname) } }
func main() { h := sha256.New() flag.Parse() h.Write([]byte(flag.Args()[0])) fmt.Printf("%x\n", h.Sum(nil)) }