Decode this password please

Discussion in 'PHP' started by JEET, Nov 10, 2008.

  1. #1
    Hi,
    This is for phpbb3. I need to create a seperate login system for it, and the password string stored in database is encrypted in some weird way. Not MD5
    Could someone please find some function/query/decoder to decode this string:
    $H$9x0FD9uiOMX2tFveULOGxsQg4COL1I1
    It should return "ssssss".

    I have been looking for 1 full day to find some code in phpbb3 to decrypt it, but still no success...
    Any help will be most appreciated :)
    Thank you :)
     
    JEET, Nov 10, 2008 IP
  2. happpy

    happpy Well-Known Member

    Messages:
    926
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    120
    #2
    you dont need to find the way to DEcode it...
    you need to find the routine in phpbb3 which ENcodes it to that string.

    this is sure a one-way encryption similar to md5 or sha1.

    dont know about phpbb3, it sure uses salt somewhere...

    i could investigate this issue for you, but you gotta hire me. no time for extended welfare ;) PM me.
     
    happpy, Nov 10, 2008 IP
  3. shineDarkly

    shineDarkly Banned

    Messages:
    241
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i agree with the post above, i have done something similar to this, the password is double hashed using a salt, and the hash used is md5
     
    shineDarkly, Nov 11, 2008 IP
  4. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #4
    i know nothing much about phpbb.
    but i found this in functions.php. This is the phpbb_hash function.
    Does it help?

    function phpbb_hash($password)
    {
    	$itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
    
    	$random_state = unique_id();
    	$random = '';
    	$count = 6;
    
    	if (($fh = @fopen('/dev/urandom', 'rb')))
    	{
    		$random = fread($fh, $count);
    		fclose($fh);
    	}
    
    	if (strlen($random) < $count)
    	{
    		$random = '';
    
    		for ($i = 0; $i < $count; $i += 16)
    		{
    			$random_state = md5(unique_id() . $random_state);
    			$random .= pack('H*', md5($random_state));
    		}
    		$random = substr($random, 0, $count);
    	}
    
    	$hash = _hash_crypt_private($password, _hash_gensalt_private($random, $itoa64), $itoa64);
    
    	if (strlen($hash) == 34)
    	{
    		return $hash;
    	}
    
    	return md5($password);
    }
    PHP:
     
    ads2help, Nov 11, 2008 IP
    JEET likes this.
  5. JEET

    JEET Notable Member

    Messages:
    3,832
    Likes Received:
    502
    Best Answers:
    19
    Trophy Points:
    265
    #5
    Hi,
    Yes, I think that must be it.
    So many thanks to you :)
    green points added.
    Thanks :)
     
    JEET, Nov 11, 2008 IP
  6. Im The ONE

    Im The ONE Peon

    Messages:
    800
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Im The ONE, Nov 11, 2008 IP
  7. bpasc95

    bpasc95 Active Member

    Messages:
    196
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    70
    #7
    Doesn't PHPBB3 have an API? If so, I think your best bet is to perform what you need via that API.

    If there is indeed an API, you can unify login between this and any other app you have running.
     
    bpasc95, Nov 11, 2008 IP