encryption - java DES encrypt code convert to ruby -
hi have java android encrypt method, , want convert ruby code.
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));
and google useful articles, still not same output. know ruby code above java code?
thx!
des = openssl::cipher::cipher.new("des-cbc") des.encrypt des.key = "xxxx" des.iv = "xxxx" cipher = des.update(str) + des.final base64.strict_encode64(cipher)
Comments
Post a Comment