1 21 22 package com.izforge.izpack.sample; 23 24 import com.izforge.izpack.panels.*; 25 26 27 34 35 public class PWDEncryptor implements Processor 36 { 37 38 51 52 public String process (ProcessingClient client) 53 { 54 if (client.getNumFields () < 1) 55 { 56 return (""); 57 } 58 59 char [] password = client.getFieldContents (0).toCharArray (); 60 char [] result = new char [password.length]; 61 int temp; 62 63 for (int i = 0; i < password.length; i++) 64 { 65 temp = password [i] - 57; 66 if (i > 0) 67 { 68 temp = temp + password [i - 1]; 69 } 70 71 if ((temp % 3) == 0) 72 { 73 temp = temp + 13; 74 } 75 if (temp < 0) 76 { 77 temp = temp + 193; 78 } 79 80 result [i] = (char)temp; 81 } 82 83 return (new String (result)); 84 } 85 } 86 87 | Popular Tags |