java代码: private static final String DES = "DES";
private static final String MODEL = "DES/CBC/PKCS5Padding";
public static String encryptDES(String encrypeString, String encrypetKey) {
byte[] encryptedData = null;
try {
IvParameterSpec zeroIv = new IvParameterSpec(IV);
SecretKeySpec key = new SecretKeySpec(encrypetKey.getBytes(), DES);
Cipher cipher = Cipher.getInstance(MODEL);
cipher.init(Cipher.ENCRYPT_MODE, key, zeroIv);
encryptedData = cipher.doFinal(encrypeString.getBytes()); } catch (Exception e) {
e.printStackTrace();
}
return Base64.encode(encryptedData);
}delphi要怎么弄 找了好几个都不行
private static final String MODEL = "DES/CBC/PKCS5Padding";
public static String encryptDES(String encrypeString, String encrypetKey) {
byte[] encryptedData = null;
try {
IvParameterSpec zeroIv = new IvParameterSpec(IV);
SecretKeySpec key = new SecretKeySpec(encrypetKey.getBytes(), DES);
Cipher cipher = Cipher.getInstance(MODEL);
cipher.init(Cipher.ENCRYPT_MODE, key, zeroIv);
encryptedData = cipher.doFinal(encrypeString.getBytes()); } catch (Exception e) {
e.printStackTrace();
}
return Base64.encode(encryptedData);
}delphi要怎么弄 找了好几个都不行
http://www.oschina.net/code/snippet_54012_13175
http://www.delphifans.com/softview/SoftView_263.html
http://coffeelover.iteye.com/blog/544632