mirror of
https://github.com/thunderbrewhq/binana.git
synced 2026-03-22 22:00:13 +00:00
This commit is contained in:
parent
ac268a16c8
commit
2c2815ab0b
22 changed files with 2122 additions and 2 deletions
19
go/app/util/hash.go
Normal file
19
go/app/util/hash.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package util
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"os"
|
||||
)
|
||||
|
||||
func hash_file(name string) (id string, err error) {
|
||||
var b []byte
|
||||
b, err = os.ReadFile(name)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
h := sha256.New()
|
||||
h.Write(b[:])
|
||||
id = hex.EncodeToString(h.Sum(nil))
|
||||
return
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue