我正在尝试使用带有ECB模式的Twofish进行加密和加密。
我尝试使用库“ gnu.crypto.cipher.Twofish”,但不允许将模式设置为ECB。
我们可以使用任何库或代码。
请帮忙。
谢谢。

最佳答案

您可以使用BouncyCastle,它实现Twofish密码

密码被实现为简单的分组密码(有效地为ECB),并且您希望实现操作模式。当您需要ECB模式(确定吗?)时,您似乎不必做更多的事情

    Security.addProvider(new BouncyCastleProvider());
    SecretKey sKey = new SecretKeySpec(Hex.decode("8ff6d560edfd395f3a1cbee18bcce3ac"), "Twofish");
    Cipher cipher = Cipher.getInstance("Twofish/ECB/NoPadding","BC");

10-08 16:04