Posted on: 9/26/2012 12:57:22 AM | Views : 213

Hi
i have the below encryption code in java... i need a similar code in c#.. can anybody help me in this???

/**
* Start password encoding before transmission
*/
private String getEncodedPwd(String pwd) throws IntegrationException
{
String result = "";
try
{
//
String passcode = "abcdefgh";
DESKeySpec keySpec = new DESKeySpec(passcode.getBytes("UTF8"));
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
SecretKey key = keyFactory.generateSecret(keySpec);
byte[] inputBytes = pwd.getBytes("UTF8");
Cipher cipher = Cipher.getInstance("DES/ECB/ISO10126Padding");
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] encryptedBytes = cipher.doFinal(inputBytes);
result = new String(Base64.encode(encryptedBytes));
}
catch (Exception e)
{
}
return result;
}
...

Go to the complete details ...