C#
private byte[] CSharpEncryptByte(byte[] InputByte, byte[] sKey)
{
DESCryptoServiceProvider DES = new DESCryptoServiceProvider();
DES.Padding = PaddingMode.Zeros;
DES.Key = sKey;
DES.IV = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 };
ICryptoTransform desencrypt = DES.CreateEncryptor();
byte[] result = desencrypt.TransformFinalBlock(InputByte, 0, InputByte.Length);
return result;
}
JAVA
public static byte[] JavaEncryptByte(byte[] InputByte, byte[] bKey)
throws Exception
{
byte[] ivdata = new byte[]{0, 0, 0, 0, 0, 0, 0, 0};
IvParameterSpec spec = new IvParameterSpec(ivdata);
SecretKeySpec keySpec = new SecretKeySpec(bKey, "DES");
Cipher cipherex = Cipher.getInstance("DES/CBC/ZeroBytePadding");
cipherex.init(Cipher.ENCRYPT_MODE, keySpec, spec);
byte[] encdata = cipherex.doFinal(InputByte, 0, InputByte.length);
return encdata;
}