I tried the 64-bit Linux binary. It seems to have a problem if the input has a null character:
% info tclversion 8.5 % load sha.so % sha 512 \0 6fd901d780c0e8c28b48600e2d94009789a8eacbd9186fcbea73e8a60c7eaf684175ffe7e4c3c1b5f8f92b14a923d56c0e4102edf92408a8eb9ee24adf4efacf % sha 512 \1 7b54b66836c1fbdd13d2441d9e1434dc62ca677fb68f5fe66a464baadecdbd00576f8d6b5ac3bcc80844b7d50b1cc6603444bbe7cfcf8fc0aa1ee3c636d9e339 % sha 512 "" cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e % sha 512 test\x00test a67240b6635e4b0758a89df60b45b02cb9d6c63c54f3d9e24cd8b7a0ee336a3309360d57daae7002cdb938c2f1f9dec9dac8dfce95b3bbfb8baaf659e70f7da9 $ echo -ne '\x00' | openssl dgst -sha512 (stdin)= b8244d028981d693af7b456af8efa4cad63d282e19ff14942c246e50d9351d22704a802a71c3580b6370de4ceb293c324a8423342557d4e5c38438f0e36910ee $ echo -ne '\x00' | sha512sum b8244d028981d693af7b456af8efa4cad63d282e19ff14942c246e50d9351d22704a802a71c3580b6370de4ceb293c324a8423342557d4e5c38438f0e36910ee - $ echo -ne '\x01' | sha512sum 7b54b66836c1fbdd13d2441d9e1434dc62ca677fb68f5fe66a464baadecdbd00576f8d6b5ac3bcc80844b7d50b1cc6603444bbe7cfcf8fc0aa1ee3c636d9e339 - $ echo -n "" | sha512sum cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e - $ echo -ne 'test\x00test'|sha512sum a5e8c64e27acdd035b9ed4b8d67aebb7b1de20a60f21cd79bf7ab1d27a03869b7ba0b06b4ae93045adf8d4a2c7cb92a3d03d5cc57b421924b97657448e163640 -
This has to do with the way Tcl handles null bytes.
It does not pass the actual nulls to the sha procedure.
You will have to get that data into a file and use the -file option.
% load sha.so
% sha 512 \0
buf:��: len: 2 (obviously incorrect)
% set fh [open t3 r]
file3
% fconfigure $fh -translation binary
% gets $fh line
1
% sha 512 $line
buf:��: len: 2
6fd901d780c0e8c28b48600e2d94009789a8eacbd9186fcbea73e8a60c7eaf684175ffe7e4c3c1b5f8f92b14a923d56c0e4102edf92408a8eb9ee24adf4efacf
% string length $line
1
% sha 512 -file t3
b8244d028981d693af7b456af8efa4cad63d282e19ff14942c246e50d9351d22704a802a71c3580b6370de4ceb293c324a8423342557d4e5c38438f0e36910ee
% set fh [open t3 r]
file3
% fconfigure $fh -translation binary
% set val [read $fh 1]
% string length $val
1
% sha 512 $val
buf:��: len: 2
6fd901d780c0e8c28b48600e2d94009789a8eacbd9186fcbea73e8a60c7eaf684175ffe7e4c3c1b5f8f92b14a923d56c0e4102edf92408a8eb9ee24adf4efacf
% set x \0
% set fh [open t4 w]
file3
% fconfigure $fh -translation binary
% puts -nonewline $fh $x
% close $fh
% sha 512 -file t4
b8244d028981d693af7b456af8efa4cad63d282e19ff14942c246e50d9351d22704a802a71c3580b6370de4ceb293c324a8423342557d4e5c38438f0e36910ee
I decided that it would be better left as is. There are other issues with text strings in Tcl
besides just null bytes and I feel it will be safer to just warn the user about using binary
data within text strings.