In this procedure, create a custom routine to execute the algorithm for password encryption.
Procedure
- In the Repository tree view of your Talend Studio, expand the Code node, right-click Routines and select Create routine from the contextual menu to create a new routine named MyRoutine.
-
In the new routine that opened in the routine editor, add a
function named decrypt and define the
specify mechanism to decrypt the encryption string of the password.
The code of the function reads as follows:
public class MyRoutine { public static String decrypt(String encryptedPassword) { StringBuffer output = new StringBuffer(); for (int i = 0; i < encryptedPassword.length(); i++) { char c = encryptedPassword.charAt(i); if (c >= 'a' && c <= 'm') c += 13; else if (c >= 'A' && c <= 'M') c += 13; else if (c >= 'n' && c <= 'z') c -= 13; else if (c >= 'N' && c <= 'Z') c -= 13; output.append(c); } return output.toString(); } }
- When done, click Ctrl+S to save your routine.