1
0
mirror of http://git.dtluna.net/tomo/go-coreutils.git synced 2025-01-07 06:39:54 +00:00

Add sha512-256sum

This commit is contained in:
dtluna 2019-03-27 14:44:53 +03:00
parent b7af56dadf
commit 5fc2672d64
3 changed files with 15 additions and 1 deletions

View File

@ -72,7 +72,7 @@ Utilities:
* [x] `sha256sum`
* [x] `sha384sum`
* [x] `sha512-224sum`
* [ ] `sha512-256sum`
* [x] `sha512-256sum`
* [x] `sha512sum`
* [ ] `sleep`
* [ ] `sort`

View File

@ -23,6 +23,7 @@ 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>.*)$")
var SHA512_224Regex = SHA224Regex
var SHA512_256Regex = SHA256Regex
// SumFunc is a type of function that computes a hash.Hash for data in io.Reader
type SumFunc func(io.Reader) (hash.Hash, error)
@ -62,6 +63,10 @@ func SHA512_224Sum(r io.Reader) (hash.Hash, error) {
return copyIntoHash(r, sha512.New512_224())
}
func SHA512_256Sum(r io.Reader) (hash.Hash, error) {
return copyIntoHash(r, sha512.New512_256())
}
type CheckingResults struct {
ImproperlyFormattedCount uint
InvalidChecksumCount uint

View File

@ -0,0 +1,9 @@
package main
import (
common "source.heropunch.io/tomo/go-coreutils"
)
func main() {
common.SumMain(common.SHA512_256Regex, common.SHA512_256Sum)
}