Skip to content

Harnish/sha256proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This code can do inline sha256 calculations godoc:

package main

import (
    "github.com/Harnish/sha256proxy"
    "fmt"
    "io"
    "os"
)

func main() {
    shain := shaproxy.New()
   
    f, err := os.Open("myfile.txt")
    if err != nil {
        fmt.Println(err)
    }

    fo, err := os.Create("junk.file")
    if err != nil {
        fmt.Println(err)
    }

    reader := shain.NewProxyReader(f)
    io.Copy(fo, reader)
    shain.Finish()
    fmt.Println(shain.SumHex())

}

I used gopkg.in/cheggaaa/pb.v1 as the example for this as I was trying to add progress to my app that sha256s the file before and after the transaction.

About

A simple golang proxy reader that returns a sha256.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages