Home > Back-end >  High marks for Delphi DES32
High marks for Delphi DES32

Time:11-16

Java code is: public static String a (byte [] paramArrayOfByte)
{
StringBuffer localStringBuffer=new StringBuffer ();
int i=0;
While (I & lt; ParamArrayOfByte. Length)
{
String STR=Integer. ToHexString (paramArrayOfByte [I] & amp; 0 XFF);
The Object localObject=STR;
If (STR) length () & lt; 2)
{
LocalObject=new StringBuilder ();
((StringBuilder) localObject). Append (" 0 ");
((StringBuilder) localObject). Append (STR);
LocalObject=((StringBuilder) localObject). The toString ();
}
LocalStringBuffer. Append ((String) localObject);
I +=1;
}
Return localStringBuffer. ToString ();
}

Public static byte [] a (String paramString1, String paramString2)
Throws the Exception
{
Cipher localCipher=Cipher. GetInstance (" DES/CBC/PKCS5Padding ");
DESKeySpec localDESKeySpec=new DESKeySpec (paramString2 getBytes (" utf-8 "));
LocalCipher. Init (1, SecretKeyFactory getInstance (" DES "). GenerateSecret (localDESKeySpec), new IvParameterSpec (paramString2. GetBytes (" utf-8 ")));
Return localCipher. DoFinal (paramString1. GetBytes (" utf-8 "));
}
}

Output is 32 bits encryption

I use the Delphi des output is 16 now and 32-bit algorithm
  • Related