Home

Awesome

Threefish

Java implementation of Threefish ver 1.3 encryption algorithm for Bouncycastle

Threefish is tweakable block encryption algorithm designed by Bruce Schneier, Niels Ferguson, Stefan Lucks, Doug Whiting, Mihir Bellare, Tadayoshi Kohno, Jon Callas, and Jesse Walker.

Currently Threefish is part of Skein hash function.

Specification

Specification of Threefish is available only as part of Skein specification: skein.pdf

Test vectors

Extracted from NIST submission package

256 bits

key   = 0000000000000000000000000000000000000000000000000000000000000000
tweak = 00000000000000000000000000000000
m     = 0000000000000000000000000000000000000000000000000000000000000000
c     = e39756f9f3b6cf3ff91d2bc3d324ce618574ea1623b2367f88382e2a93afa858

key   = 101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f
tweak = 000102030405060708090a0b0c0d0e0f
m     = FFFEFDFCFBFAF9F8F7F6F5F4F3F2F1F0EFEEEDECEBEAE9E8E7E6E5E4E3E2E1E0
c     = 1e9b8f641bed9511be4f40df57c3d7a1bc42718edd7af7139b3d4c52b2a920f8

512 bits

key   = 0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
tweak = 00000000000000000000000000000000
m     = 0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
c     = 408be942494492eab19daa3e96ad19aedfc41f4e55f8a2626c1e46d54547a713
        d43b21f0de1a10881ed5c4adefdad1c4172cd768c8fc28d0dde9df018042fe3e

key   = 101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f
        303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f
tweak = 000102030405060708090a0b0c0d0e0f
m     = fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0
        dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0
c     = 869ae12210e51d3b0736399f2acb400de230600b13e62f1df7596a146232d281
        dfbf127a65571b9a798906c719678394c50d995138fd83f2bfa54a3bc350d2f0

1024 bits

key	  = 0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
tweak = 00000000000000000000000000000000
m     = 0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
c     = 43cf2a34cb1668e38c2e19ea1757d6b31ac6dead02fea99459d8a0331bdc7273
        a1f7e9495d60402d1f8b43e48a5ac4f9d9d30965835e07f5455b87f963fdbca6
        df66b4446b91ffdd27634573f6e0e4c19633cf80da8fe11b890bcf639ac67b34
        7f87c5daa1acc1b8cd0303f4a9168c0b9b7b78baa6fc68db2cbd3337b8519170

key   = 101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f
        303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f
        505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f
        707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f
tweak = 000102030405060708090a0b0c0d0e0f
m     = fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0
        dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0
        bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a0
        9f9e9d9c9b9a999897969594939291908f8e8d8c8b8a89888786858483828180
c     = 44e66b3125aa434261adbef4c310101cef1d185272b43132d6e67e75692b2851
        a7e3acf8dfd3d6c6dfea2724150d287e8c2babff27e971fac163781be181f2bf
        572ab84862259ef8fa628a77a61d128f2f1517bd518592fe9382ff670d848ada
        b31582dccf36c2c607153aae34a2853ff0c14cf462c903cc2860734ae50c04b1