mirror of
http://git.dtluna.net/tomo/go-coreutils.git
synced 2025-01-07 06:29:52 +00:00
Add sha512sum
This commit is contained in:
parent
bf5b250df8
commit
baeafa3ab5
@ -73,7 +73,7 @@ Utilities:
|
||||
* [x] `sha384sum`
|
||||
* [ ] `sha512-224sum`
|
||||
* [ ] `sha512-256sum`
|
||||
* [ ] `sha512sum`
|
||||
* [x] `sha512sum`
|
||||
* [ ] `sleep`
|
||||
* [ ] `sort`
|
||||
* [ ] `split`
|
||||
|
@ -21,6 +21,7 @@ var SHA1Regex = regexp.MustCompile("^(?P<hash>[0-9a-f]{40}) (?P<filename>.*)$")
|
||||
var SHA224Regex = regexp.MustCompile("^(?P<hash>[0-9a-f]{56}) (?P<filename>.*)$")
|
||||
var SHA256Regex = regexp.MustCompile("^(?P<hash>[0-9a-f]{64}) (?P<filename>.*)$")
|
||||
var SHA384Regex = regexp.MustCompile("^(?P<hash>[0-9a-f]{96}) (?P<filename>.*)$")
|
||||
var SHA512Regex = regexp.MustCompile("^(?P<hash>[0-9a-f]{128}) (?P<filename>.*)$")
|
||||
|
||||
// SumFunc is a type of function that computes a hash.Hash for data in io.Reader
|
||||
type SumFunc func(io.Reader) (hash.Hash, error)
|
||||
@ -52,6 +53,10 @@ func SHA384Sum(r io.Reader) (hash.Hash, error) {
|
||||
return copyIntoHash(r, sha512.New384())
|
||||
}
|
||||
|
||||
func SHA512Sum(r io.Reader) (hash.Hash, error) {
|
||||
return copyIntoHash(r, sha512.New())
|
||||
}
|
||||
|
||||
type CheckingResults struct {
|
||||
ImproperlyFormattedCount uint
|
||||
InvalidChecksumCount uint
|
||||
|
9
sha512sum/sha512sum.go
Normal file
9
sha512sum/sha512sum.go
Normal file
@ -0,0 +1,9 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
common "source.heropunch.io/tomo/go-coreutils"
|
||||
)
|
||||
|
||||
func main() {
|
||||
common.SumMain(common.SHA512Regex, common.SHA512Sum)
|
||||
}
|
Loading…
Reference in New Issue
Block a user