Hi,
We have a old application in asp-sqlserver .users create login n change password from there.
Now i m working on new modules Grails(/java) and same old database. while trying to change password we use following logic for encryption(new & old website change pwd).
But if i use this & save in DB ,it never matches becoz in
java after ASCII value(127) it prints everything as ? .
how can i print the extended ascii values while encryption.?
Code is as below-
public class StrSearch1{
public static void main(
String args[]){
String encoded = encode("sviadha");
System.out.println("******Encoded*******"+ encoded);
}
/**
* This would encrypt the password
* @param encode - string to be encoded
* @return
*/
static String getEncodedString(String encode) {
StringBuffer outputBuff = new StringBuffer()
print("ENCODE START --input string=="+encode)
for (int i = 0; i < encode.length(); ++i) {
char ch = encode.charAt(i)
int asciiCh =(int) ch
int encryptCh = asciiCh + 20
outputBuff = outputBuff.append((char)encryptCh)
}
print("END ENCODE--output string=="+outputBuff)
return outputBuff.toString()
}
}
Result -
******Encoded******* ??ux|u
NOte :- it returns ? for any char after 'k'
Tried byte arrays as well.Please suggest.