manually create encrypted/decrypted password

From: MicroFace <MicroFace_at_hotmail.com>
Date: Mon, 26 Jan 2004 22:53:46 -0800
Message-ID: <jl2c10h6o0jfauv7qqqsah6nb3um9f8rne_at_4ax.com>


You can use this algo to manually create the encrypted password generated by the Oracle Mapping Work Bench. This can also be used of course with a little work to Decrypt the password stored in the xml file.

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=5&txtCodeId=803

constants:

even indexed characters = 4

odd indexed characters = 112

append string=A7FCAA504BA7E4FC  

Even rule:

ascii value of the current character (plus) + 4, (minus) - "position of the current character".  

Odd rule

ascii value of the current character (plus) + 112, we then add the result of the expression : "position of the current character " - 1. divide the result by 2.

then multiply the result by 6.  

Algorithm:

for each character of the password string say for example "password", apply the rule depending on whether the index of the character of the password string is odd or even.  

Example.

first character is "p" which has the even index so we apply the "even rule."

ascii value of "p" is 112. we add 4 minus 0, we get 116. Then we convert this into HEX which is equivalent to "74"  

 second character is "a" and it has an odd index.

ascii value is 97. 97 plus the 112 = 224. postion of the current character is 1. so we subtract 1 we get 0. we divide 0 by 2 and we still get 0. then we multiply the result by 6 and still get 0 there fore nothing is added to 224. Then we convert this into HEX which is equivalent to "E0". Then we append this to our

previous result for the previous character which is "74" to get "74E0".

do this process for the rest of the characters of the password. then append the string "A7FCAA504BA7E4FC"

there we have the encryption process used by Oracle Toplink Mapping WorkBench.  

Sample Code:

private String encodePassword(String password) { String retVal="";
char c;
int num=0;

for (int i=0;i<password.length();i++) {
c=password.charAt(i);
num = (int)c;
System.out.println ("char="+c+" num="+num); if (i%2==0) {
retVal = retVal+Integer.toHexString(num + 4 - i) + "";
} else {

retVal = retVal+Integer.toHexString(num + 112 - (((i - 1) / 2) * 6)) + "";
}
}

retVal = retVal.toUpperCase();
retVal = retVal+"A7FCAA504BA7E4FC";
return retVal;
}
Received on Tue Jan 27 2004 - 07:53:46 CET

Original text of this message