java DES加密代码转换为ruby

时间:2015-07-30 09:37:14

标签: ruby encryption openssl des

您好我有一个java android加密方法,并希望转换为ruby代码。

IvParameterSpec localIvParameterSpec = new IvParameterSpec(new byte[] { 12, 34, 34, 11, 64, 23, 89, 27 });

DESKeySpec localDESKeySpec = new DESKeySpec(paramString2.getBytes());

SecretKey localSecretKey = SecretKeyFactory.getInstance("DES").generateSecret(localDESKeySpec);

Cipher localCipher = Cipher.getInstance("DES/CBC/PKCS5Padding");

localCipher.init(1, localSecretKey, localIvParameterSpec);

return new String(Base64.encode(localCipher.doFinal(paramString1.getBytes()), 0));

我谷歌一些有用的文章,但仍然无法获得相同的输出。 所以任何人都知道上面的java代码的ruby代码?

THX!

1 个答案:

答案 0 :(得分:0)

foreach(var destination in destinations)
{
    Console.WriteLine(destination.Description);
    Console.WriteLine(destination.Text);
    Console.WriteLine("\n");
}