diff --git a/README.md b/README.md index d1672ce..61d3c1d 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Utilities: * [x] `sha256sum` * [x] `sha384sum` * [x] `sha512-224sum` - * [ ] `sha512-256sum` + * [x] `sha512-256sum` * [x] `sha512sum` * [ ] `sleep` * [ ] `sort` diff --git a/hashsum.go b/hashsum.go index 7ae2dc0..05393ed 100644 --- a/hashsum.go +++ b/hashsum.go @@ -23,6 +23,7 @@ var SHA256Regex = regexp.MustCompile("^(?P[0-9a-f]{64}) (?P.*)$ var SHA384Regex = regexp.MustCompile("^(?P[0-9a-f]{96}) (?P.*)$") var SHA512Regex = regexp.MustCompile("^(?P[0-9a-f]{128}) (?P.*)$") 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 diff --git a/sha512-256sum/sha512-256sum.go b/sha512-256sum/sha512-256sum.go new file mode 100644 index 0000000..2ca14a6 --- /dev/null +++ b/sha512-256sum/sha512-256sum.go @@ -0,0 +1,9 @@ +package main + +import ( + common "source.heropunch.io/tomo/go-coreutils" +) + +func main() { + common.SumMain(common.SHA512_256Regex, common.SHA512_256Sum) +}