Skip to content

rharink/go-checksum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Checksum

Create checksums with ease

##Installation Download and install go-checksum with go get

go get github.com/rauwekost/go-checksum

##Usage

package main

import (
  "crypto"
  "fmt"

  "github.com/rauwekost/go-checksum"
)

func main() {
  //md5 of a string
  c, err := checksum.String("password", crypto.MD5)
  if err != nil {
    panic(err)
  }
  fmt.Printf("MD5 = %s\n", c)

  //sha1 of a string
  c, err = checksum.String("password", crypto.SHA1)
  if err != nil {
    panic(err)
  }
  fmt.Printf("SHA1 = %s\n", c)

  //sha256 of a file
  c, err = checksum.File("testfile.txt", crypto.SHA256)
  if err != nil {
    panic(err)
  }
  fmt.Printf("SHA256 = %s\n", c)
}

About

Easy checksums in go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages