LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-30-2008, 04:29 AM   #1
lynx5
LQ Newbie
 
Registered: Jan 2008
Posts: 5

Rep: Reputation: 0
need help unpacking hmac-md5 hash into md5 hash


Hey Im wondering if theres any code out there to unpack a hmac-md5 hash (with the key) back to the original md5.. I would assume this fairly easy to do and there should be code out there.. I cant find it however.. much appericated. thanks, (and I dont code myself or I would make it) well I do in perl but not php.

heres all the packing that is done anyways not much code here as you can see.. I would just like to UNPACK it.. maybe someone could write a few lines of code for me?

<?php

$hash = md5_hmac(yycc, yyaa);

// MD5 Encryption
function md5_hmac($data, $key)
{

if (strlen($key) > 64)
$key = pack('H*', md5($key));
$key = str_pad($key, 64, chr(0x00));

$k_ipad = $key ^ str_repeat(chr(0x36), 64);
$k_opad = $key ^ str_repeat(chr(0x5c), 64);

return md5($k_opad . pack('H*', md5($k_ipad . $data)));
}

?>


thanks..

Last edited by lynx5; 01-30-2008 at 04:33 AM.
 
Old 01-30-2008, 09:20 PM   #2
rubadub
Member
 
Registered: Jun 2004
Posts: 236

Rep: Reputation: 33
I was just starting to work through it and realised it finished like this:
Code:
return md5($k_opad . pack('H*', md5($k_ipad . $data)));
which means the last action applies a one way function to it, sorry no return!
 
Old 02-01-2008, 09:23 AM   #3
lynx5
LQ Newbie
 
Registered: Jan 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by rubadub View Post
I was just starting to work through it and realised it finished like this:
Code:
return md5($k_opad . pack('H*', md5($k_ipad . $data)));
which means the last action applies a one way function to it, sorry no return!
I think its still possible, because all we want to do is find the orignial md5 hash not reverse it. so we would call md5 UNPACKED $data.. so that would be the same as md5 $data, jsut tryin to elimate the packing process, make sense?
 
Old 02-02-2008, 04:06 PM   #4
rubadub
Member
 
Registered: Jun 2004
Posts: 236

Rep: Reputation: 33
The last operation on the statement is itself a md5 one way hash sum, before that is a salt concatenated with a pack of padding and a hash sum of the data and a salt.

If you think you can do it without a lookup or by using brute force then good luck (and when I say good luck, I mean have a 'Good Look!')...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Create MD5 hash from string trouby Linux - General 9 02-07-2012 07:08 PM
hash bye md5 algorithm vishalbutte Programming 5 02-18-2006 10:54 PM
checking MD5 hash issey Linux - Newbie 4 03-31-2005 01:15 AM
mass MD5 hash generation w3man Programming 2 01-31-2005 09:05 PM
MD5 hash value dominant Linux - Newbie 2 05-07-2004 03:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration