Password Encryption

Joined
Apr 8, 2011
Messages
3
Reaction score
0
Hello there,

Im currently trying to hash plain text into encrypted perfect world passwords

example:

If the password was: test1234

the hash generated in the database is: °tóO­Do„Ìà» Çè

Does anyone know the encryption algorithm used?

Thanks! :laugh:
 
Here ya go:

F(X,Y,Z)=(X˄Y)˅(┐X˄Z)
G(X,Y,Z)=(X˄Z)˅(Y˄┐Z)
H(X,Y,Z)=XɵYɵZ
I(X,Y,Z)=Yɵ(X˅┐Z)

---------- Post added at 03:22 PM ---------- Previous post was at 03:09 PM ----------

The algorithm is calculated according to this:

//Note: All variables are unsigned 32 bits and wrap modulo 2^32 when calculating
var int[64] r, k

//r specifies the per-round shift amounts
r[ 0..15] := {7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22}
r[16..31] := {5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20}
r[32..47] := {4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23}
r[48..63] := {6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21}

//Use binary integer part of the sines of integers (Radians) as constants:
for i from 0 to 63
k := floor(abs(sin(i + 1)) × (2 pow 32))

//Initialize variables:
var int h0 := 0x67452301
var int h1 := 0xEFCDAB89
var int h2 := 0x98BADCFE
var int h3 := 0x10325476

//Pre-processing:
append "1" bit to message
append "0" bits until message length in bits ≡ 448 (mod 512)
append bit /* bit (not byte) length of unpadded message as 64-bit little-endian integer to message

//Process the message in successive 512-bit chunks:
for each 512-bit chunk of message
break chunk into sixteen 32-bit little-endian words w[j], 0 ≤ j ≤ 15

//Initialize hash value for this chunk:
var int a := h0
var int b := h1
var int c := h2
var int d := h3

//Main loop:
for i from 0 to 63
if 0 ≤ i ≤ 15 then
f := (b and c) or ((not b) and d)
g := i
else if 16 ≤ i ≤ 31
f := (d and b) or ((not d) and c)
g := (5×i + 1) mod 16
else if 32 ≤ i ≤ 47
f := b xor c xor d
g := (3×i + 5) mod 16
else if 48 ≤ i ≤ 63
f := c xor (b or (not d))
g := (7×i) mod 16

temp := d
d := c
c := b
b := b + leftrotate((a + f + k + w[g]) , r)
a := temp

//Add this chunk's hash to result so far:
h0 := h0 + a
h1 := h1 + b
h2 := h2 + c
h3 := h3 + d

var char digest[16] := h0 append h1 append h2 append h3 //(expressed as little-endian)

//leftrotate function definition
leftrotate (x, c)
return (x << c) or (x >> (32-c));


(0 ≤ i ≤ 15): f := d xor (b and (c xor d))
(16 ≤ i ≤ 31): f := c xor (d and (b xor c))
 
Last edited:
nice one 343, i was thinking of writing a simple password change script that kinda worked the normal way o.o, you know
name + password + md5 and all that yummy stuff, but on registration instead of having a second password such as "$Repass" it will write it in plain text so you will have the encrypted password and the repeated password in plain text
so when you want to change your password, it will change second password, and encrypt it the same way the register script does it, sound good?

and its good to be back!
 
I tried what was suggested

with md5 (login + pass)

got this:


Hashed Password: f9bd13dda5671a275e21fd7ba557ff66


Still don't look like the password in the database!

Code:

Code:
<?php		
		$pass = "joshtest";
		$login = "joshtest";
                $finalpw = $login.$pass;
		$finalpw = md5($finalpw);
		$test = bin2hex($finalpw);
		echo "<b>Username:</b>  ".$login."<br>";
		echo "<b>Password:</b>  ".$pass."<br>";
		echo "<b>Hashed Password:</b>  ".$finalpw."<br>";
		echo "<b>Other:</b>  ".$test."<br>";
?>
 
Last edited:
you forgot the 0x i believe
$Salt = $Login.$Pass;
$Salt = md5($Salt);
$Salt = "0x".$Salt;
this is what is used to get the password when you register in trash's original register script. maybe that would help.
 
Last edited:
I tried what was suggested

with md5 (login + pass)

got this:


Hashed Password: f9bd13dda5671a275e21fd7ba557ff66


Still don't look like the password in the database!

Code:

Code:
<?php		
		$pass = "joshtest";
		$login = "joshtest";
                $finalpw = $login.$pass;
		$finalpw = md5($finalpw);
		$test = bin2hex($finalpw);
		echo "<b>Username:</b>  ".$login."<br>";
		echo "<b>Password:</b>  ".$pass."<br>";
		echo "<b>Hashed Password:</b>  ".$finalpw."<br>";
		echo "<b>Other:</b>  ".$test."<br>";
?>

Yes it is the same thing, just output in hex...
 
Code:
Username: joshtest
Password: joshtest
Hashed Password: f9bd13dda5671a275e21fd7ba557ff66
Hexed Password: 6639626431336464613536373161323735653231666437626135353766663636

Still don't look like:

ù½Ý¥g'^!ý{¥Wÿf


Am i missing something guys?


Code used:

Code:
<?php		
	$pass = "joshtest";
	$login = "joshtest";
	$finalpw = $login.$pass;
	$finalpw = md5($finalpw);
	$test = bin2hex($finalpw);
	echo "<b>Username:</b>  ".$login."<br>";
	echo "<b>Password:</b>  ".$pass."<br>";
	echo "<b>Hashed Password:</b>  ".$finalpw."<br>";
	echo "<b>Hexed Password:</b>  ".$test."<br>";
?>
 
Code:
Username: joshtest
Password: joshtest
Hashed Password: f9bd13dda5671a275e21fd7ba557ff66
Hexed Password: 6639626431336464613536373161323735653231666437626135353766663636

Still don't look like:

ù½Ý¥g'^!ý{¥Wÿf


Am i missing something guys?


Code used:

Code:
<?php		
	$pass = "joshtest";
	$login = "joshtest";
	$finalpw = $login.$pass;
	$finalpw = md5($finalpw);
	$test = bin2hex($finalpw);
	echo "<b>Username:</b>  ".$login."<br>";
	echo "<b>Password:</b>  ".$pass."<br>";
	echo "<b>Hashed Password:</b>  ".$finalpw."<br>";
	echo "<b>Hexed Password:</b>  ".$test."<br>";
?>

I told you already, f9bd13dda5671a275e21fd7ba557ff66 = ù½Ý¥g'^!ý{¥Wÿf

f9bd13dda5671a275e21fd7ba557ff66 is the hex representation

Don't believe me paste it in the "Hex" box
 
in php use md5($value, true) to get binary output, by default function returns hex string. See:

P.S. also in your code, you need to apply "strtolower()" on the login (not pass)
Code:
<?php		
	$pass = "joshtest";
	$login = "joshtest";
	$finalpw = md5(strtolower($login).$pass, true);
	echo "<b>Username:</b>  ".$login."<br>";
	echo "<b>Password:</b>  ".$pass."<br>";
	echo "<b>Hashed Password:</b>  ".$finalpw."<br>";
?>
 
Last edited:
in php use md5($value, true) to get binary output, by default function returns hex string. See:

P.S. also in your code, you need to apply "strtolower()" on the login (not pass)
Code:
<?php		
	$pass = "joshtest";
	$login = "joshtest";
	$finalpw = md5(strtolower($login).$pass, true);
	echo "<b>Username:</b>  ".$login."<br>";
	echo "<b>Password:</b>  ".$pass."<br>";
	echo "<b>Hashed Password:</b>  ".$finalpw."<br>";
?>

Its better to stick 0x in front of it and let MySQL do the binary conversion... there is a chance that the charset used on the table will corrupt the data if you just try sending it binary...
 
Back