SHA
Each exported function (at the time of this writing, SHA-1, SHA-2 224, 256, 384 and 512, and SHA-3 224, 256, 384 and 512 functions are implemented) takes in either an , a ByteString
or an IO
object. This makes it trivial to checksum a file:
shell> cat /tmp/test.txt
test
julia> using SHA
julia> open("/tmp/test.txt") do f
sha2_256(f)
end
0x9f
0x86
0x81
0x88
0x4c
0x7d
⋮
0x5d
0x6c
0x15
0xb0
0xf0
0x0a
Due to the colloquial usage of sha256
to refer to sha2_256
, convenience functions are provided, mapping shaxxx()
function calls to sha2_xxx()
. For SHA-3, no such colloquialisms exist and the user must use the full sha3_xxx()
names.
Note that, at the time of this writing, the SHA3 code is not optimized, and as such is roughly an order of magnitude slower than SHA2.