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:

    1. shell> cat /tmp/test.txt
    2. test
    3. julia> using SHA
    4. julia> open("/tmp/test.txt") do f
    5. sha2_256(f)
    6. end
    7. 0x9f
    8. 0x86
    9. 0x81
    10. 0x88
    11. 0x4c
    12. 0x7d
    13. 0x5d
    14. 0x6c
    15. 0x15
    16. 0xb0
    17. 0xf0
    18. 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.