diff --git a/README.md b/README.md index a3bca9d..d1672ce 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ Utilities: * [x] `sha224sum` * [x] `sha256sum` * [x] `sha384sum` - * [ ] `sha512-224sum` + * [x] `sha512-224sum` * [ ] `sha512-256sum` * [x] `sha512sum` * [ ] `sleep` diff --git a/hashsum.go b/hashsum.go index ad40577..7ae2dc0 100644 --- a/hashsum.go +++ b/hashsum.go @@ -22,6 +22,7 @@ var SHA224Regex = regexp.MustCompile("^(?P[0-9a-f]{56}) (?P.*)$ 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 // SumFunc is a type of function that computes a hash.Hash for data in io.Reader type SumFunc func(io.Reader) (hash.Hash, error) @@ -57,6 +58,10 @@ func SHA512Sum(r io.Reader) (hash.Hash, error) { return copyIntoHash(r, sha512.New()) } +func SHA512_224Sum(r io.Reader) (hash.Hash, error) { + return copyIntoHash(r, sha512.New512_224()) +} + type CheckingResults struct { ImproperlyFormattedCount uint InvalidChecksumCount uint diff --git a/sha512-224sum/sha512-224sum.go b/sha512-224sum/sha512-224sum.go new file mode 100644 index 0000000..b62e187 --- /dev/null +++ b/sha512-224sum/sha512-224sum.go @@ -0,0 +1,9 @@ +package main + +import ( + common "source.heropunch.io/tomo/go-coreutils" +) + +func main() { + common.SumMain(common.SHA512_224Regex, common.SHA512_224Sum) +}