You are here: hacking technology > encryption decipher > Content
Hot Articles
Recommend Articles
New Articles
Uses the MD5 transformation algorithm to prevent the exhaustive attack password
  Add date: 11/05/2008   Publishing date: 11/05/2008   Hits: 69
Total 3 pages, Current page:1, Jump to page:
 
MD5 is in the Web application procedure the most commonly used password encryption algorithm. Because MD5 is irreversible, thus obtains the scrambled text after the MD5 computation, cannot obtain the original text through the reversion algorithm.

The review uses the MD5 encryption text password in the Web application procedure the original intention, after is to prevent the password unfortunate revelation which, in the database preserves is obtained directly. But not only the aggressor has the data quantity huge password dictionary, and has established many MD5 original text/scrambled text comparison database, could find the commonly used password fast the MD5 scrambled text, was breaks the MD5 scrambled text the highly effective way. However, what the MD5 scrambled text database uses is the conventional MD5 encryption algorithm: Original text-->MD5--> scrambled text. Therefore, we may use the transformation the MD5 algorithm, causes the ready-made MD5 scrambled text database to accomplish nothing.

Following demonstrates some transformation algorithm the example, certainly, in other Web development language, is also mostly the same except for minor differences, can definitely obtain the same result.

Transforms one: Circulates MD5

The most understand easily's transformation is carries on the multiple MD5 operation to a password. From defines a function, it accepts $data and the $times two shape senate, the first password which is must encrypt, second is redundant the encryption the number of times. Realizes this kind of transformation to have two algorithms:


// iterative algorithm
function md5_1_1 ($data, $times = 32)
{
// recycle MD5
for ($i = 0; $i < $times; $i++) {
$data = md5($data);
}
return $data;
}
// recursive algorithm
function md5_1_2 ($data, $times = 32)
{
if ($times > 0) {
$data = md5($data);
$times--;
return md5_1_2 ($data, $times); // realizes the recursion
} else {
return $data;
}
}
? >
 

Transforms two: The scrambled text divides MD5

Although user's password is the indefinite string of character, so long as but undergoes a MD5 operation, will obtain one string of character which is composed of 32 characters, by now might aim at this fixed-length string of character transformation again. A little the BT algorithm is, divides certain sections this section of scrambled texts, carries on a MD5 operation to each section, then this pile of scrambled text Lian Cheng a ultra long string of character, carries on again finally a MD5 operation, obtained was still the length is 32 scrambled texts.


// divides the scrambled text two sections, each section of 16 characters
function md5_2_1($data)
{
// encrypts the password the length is 32 character scrambled texts first
$data = md5($data);
// divides the password two sections
$left = substr ($data, 0, 16);
$right = substr ($data, 16, 16);
after // encrypts separately, merges again
$data = md5($left).md5($right);
// encrypts again finally the long string one time, becomes 32 character scrambled texts

 
Other pages: : 1 * 2 * 3 * Next>>
Prev:Encrypts a spot to pass transparently Next:SQL encryption of technique and SQL the Server security pour into the attack

Comment:

Category: Home > encryption decipher