Implementation of sha256sum using POSIX utilities.
Eric Bavier f07db6b50d sha256sum: precompute powers of 2. | 3 gadi atpakaļ | |
---|---|---|
.gitignore | 4 gadi atpakaļ | |
README.md | 4 gadi atpakaļ | |
bench-bc.sh | 4 gadi atpakaļ | |
sha256sum.sh | 3 gadi atpakaļ |
This is a terrible, yet functional and correct, implementation of sha256sum using POSIX shell and utilities. I wrote it out of curiosity, and to learn a little more about what existing utilities are capable of.
It is incredibly slow, needing about 4 seconds per KiB on my system.
$ echo "foo" >/tmp/foo; echo "bar" >/tmp/bar
$ ./sha256sum.sh /tmp/foo /tmp/bar
b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c /tmp/foo
5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03 /tmp/bar
$ sha256sum /tmp/foo /tmp/bar
b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c /tmp/foo
5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03 /tmp/bar