Probably a bug:

key = GenerateSymmetricKey[
      Method -> <|"Cipher" -> "Blowfish", "KeySize" -> 16|>]
Encrypt[key, "test"]

Encrypt::invkeyspec: Key should a string or valid SymmetricKey, PrivateKey, or PublicKey.

Even though the documentation says:

  • The following ciphers can use any key size that is a multiple of 8:


1 Answer 1


Sometimes the documentation is misleading. According to Wikipedia, Blowfish keys should be between 32 and 448 bits. For some reason, Encrypt insists a Blowfish key be a multiple of 64, and will accept any such key, even ones larger than 448 (7 x 64).

BlowfishTest[k_, msg_String] :=
   key = GenerateSymmetricKey[Method -> <|"Cipher" -> "Blowfish", "KeySize" -> k 64|>]; 
  Decrypt[key, Encrypt[key, msg]]]

The following tests all keys that are multiples of 64 up 1024 (16 x 64).

With[{msg = "This is a test."}, 
  AllTrue[Table[BlowfishTest[k, msg], {k, 16}], # == msg &]]



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.