NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Reversable Encryption OR Storing Passwords online

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 05-24-2006, 03:37 PM   #26 (permalink)
Account Closed
 
abdulmueid's Avatar
Join Date: Jun 2005
Location: Mozambique
Posts: 607
abdulmueid has a spectacular aura aboutabdulmueid has a spectacular aura about
 



From what i've read, mcrypt and base64 use a fixed algorithm for encrypting data so they know that by reversing that algo, it is decrypted.

Now a hash like MD5 generates a random algorithm at the time of encryption, encrypts the string and now the algorithm doesn't exist anymore.. therefore irreversible. Correct me if I am wrong.. someone.
abdulmueid is offline  
Old 05-24-2006, 03:41 PM THREAD STARTER               #27 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



wow, that is absolutely ingenious! I would never have thought of that.

Theoretically, that algorithm is reversible if found out though right?

I am thinking if there is anyway of doing something like that, but then with a reversible function. Maybe storing an encryption key in the string or something? I suppose it will still be reversible, but then again the more ambiguous, the more secure right?
PoorDoggie is offline  
Old 05-24-2006, 03:52 PM   #28 (permalink)
Account Closed
 
abdulmueid's Avatar
Join Date: Jun 2005
Location: Mozambique
Posts: 607
abdulmueid has a spectacular aura aboutabdulmueid has a spectacular aura about
 



A hash is definately more secure than anything else... but I would still prefer to have my own algorithm.

And yes, the more ambiguous, the more secure..
abdulmueid is offline  
Old 05-24-2006, 04:33 PM   #29 (permalink)
Senior Member
 
nasaboy007's Avatar
Join Date: Jul 2005
Location: NJ
Posts: 1,219
nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of
 



Quote:
Now a hash like MD5 generates a random algorithm at the time of encryption, encrypts the string and now the algorithm doesn't exist anymore.. therefore irreversible. Correct me if I am wrong.. someone.
how could that be? if it made a new algorithm each time, it would not get the same result from the same input text each time.
????: NamePros.com http://www.namepros.com/programming/199278-reversable-encryption-or-storing-passwords-online.html


Quote:
I am thinking if there is anyway of doing something like that, but then with a reversible function. Maybe storing an encryption key in the string or something? I suppose it will still be reversible, but then again the more ambiguous, the more secure right?
as for that, how about u just pick like the 2nd letter (or better yet, make it like the second to last letter so that it changes depending on the length of the actual password) and convert that into binary. then once thats binary i guess u cud convert that back into its numerical value rather than text and use that as ur key value. of course, this number will most likely be INSANELY GINORMOUSLY LARGE for the purpose of base64 multiple times. so i suggest then taking that base 10 (decimal) value and subjecting it to various mathematical functions that will bring it down to a smaller value if it is over a certain value. of course, if the number comes down to something less than 10 (or w/e) it sumwhat defeats the purpose of doing all this since u wanted to generate a key that would be hard to brute force...

well if there was a better way to encode (much much faster) than base64, that method above (minus the whole make the humongous number smaller thing) would probably be the best bet.


as for decrypting it... ehhhhhhhhh


-_- damn it i did all that work and realized that it would be impossible (or next to impossible) to decode that sort of encryption without the original password...

well unless sum1 can think of one, cuz my brain is fried X_X


but hey thats a good idea
nasaboy007 is offline  
Old 05-25-2006, 03:49 AM THREAD STARTER               #30 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



lol - I think I will just take a key and do hurrendous mathematical stuff to it, and then base64 it a few times depending on the size of the resulting number! lol - a long string is a little bit OTT maybe.
PoorDoggie is offline  
Old 05-25-2006, 11:13 AM   #31 (permalink)
Senior Member
 
Shorty's Avatar
Join Date: Sep 2005
Location: England
Posts: 1,034
Shorty is just really niceShorty is just really niceShorty is just really niceShorty is just really nice
 



I was thinking yesterday, that if you did a few random string manipulation things and character replacements before you md5() the string, it would be a million times more secure...because, when the hacker brute forces the hash, instead of getting the password he'll get the manipulated version, and they'd still have to know what replaces what before they get the original...

And now that I think about that...imagine having a set of string replacements, then md5()'ing it, THEN manipulating the hash AGAIN and then md5()'ing it again...
Shorty is offline  
Old 05-25-2006, 01:54 PM THREAD STARTER               #32 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



kinda like my base64 method, but with md5? Thats a good idea, just to make it that little bit more secure. What I have done in the past is taken the first 16 letters of an md5 string and put them at the end. This way the string is different, but it also means more php code, and less efficient code.
PoorDoggie is offline  
Old 05-26-2006, 08:08 PM   #33 (permalink)
Senior Member
 
nasaboy007's Avatar
Join Date: Jul 2005
Location: NJ
Posts: 1,219
nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of
 



but i thot the whole point of this was to make it decryptable... whats the point of using md5 if u cant decrypt that?
nasaboy007 is offline  
Old 05-27-2006, 08:25 AM   #34 (permalink)
NamePros Regular
 
Tree's Avatar
Join Date: Feb 2006
Location: Atlanta, GA, USA
Posts: 335
Tree will become famous soon enoughTree will become famous soon enough
 



Just so you know, md5 is way more efficient than base64. Multiple instances anyways. On my server it seems to be different.

http://www.ncisolutions.com/misc/base64_md5.php

Try it out on your own server:

PHP Code:
<?php 
function dbConnect(){
    
mysql_connect("localhost","*************","******")
        or die(
"Couldn't connect to the database because ".mysql_error());
    
mysql_select_db("*************")
        or die(
"Couldn't select database because ".mysql_error());
}

function 
randomChar($length)
{
$password "";
$possible "0123456789abcdefghijklmnopqrstuvwxyz";
$i 0;
while (
$i $length) {
$char substr($possiblemt_rand(0strlen($possible)-1), 1);
if (!
strstr($password$char)) {
$password .= $char;
$i++;
}

}
return 
$password;
}
$string randomChar(rand(7,rand(8,rand(9,rand(rand(15,21),rand(22,37))))));
????: NamePros.com http://www.namepros.com/showthread.php?t=199278
for (
$i=0;$i<50;$i++){
$timeparts explode(' ',microtime());
$thetime $timeparts[1].substr($timeparts[0],1);

$md5_string md5($string);

$timeparts explode(' ',microtime());
$starttime $timeparts[1].substr($timeparts[0],1);
$timeparts explode(' ',microtime());
$endtime $timeparts[1].substr($timeparts[0],1);
$difference[$i] = bcsub($endtime,$starttime,6);
}
$md5_endtime = (array_sum($difference))/50;

for (
$i=0;$i<50;$i++){
$timeparts explode(' ',microtime());
$thetime $timeparts[1].substr($timeparts[0],1);

$base64_string base64_encode($string);

$timeparts explode(' ',microtime());
$starttime $timeparts[1].substr($timeparts[0],1);
$timeparts explode(' ',microtime());
$endtime $timeparts[1].substr($timeparts[0],1);
$difference[$i] = bcsub($endtime,$starttime,6);
}
$base64_endtime = (array_sum($difference))/50;

echo 
"<b>Original String:</b>".$string."<br><br>";
echo 
"<b>Final md5 Time:</b> ";
echo 
number_format($md5_endtime70'.''');
echo 
"<br>";
echo 
"Final md5 String: ";
echo 
$md5_string;
echo 
"<br><br><b>Final base64 Time:</b> ";
echo 
number_format($base64_endtime70'.''');
echo 
"<br>";
echo 
"Final base64 String: ";
echo 
$base64_string;
echo 
"<br><br><b>Fastest:</b> ";
dbConnect();
if (
$md5_endtime $base64_endtime
{
    echo 
"MD5 <br><b>By</b> ".number_format($base64_endtime-$md5_endtime70'.''')." <b>seconds</b>.";
    
$query mysql_query("SELECT * FROM `base64_md5`");
    
$row mysql_fetch_array($query);
    
$newval $row['md5']+1;
    
mysql_query("UPDATE `base64_md5` SET `md5` = '$newval' WHERE `id` =0 LIMIT 1 ;");
}
if (
$md5_endtime $base64_endtime
{
    echo 
"Base64 <br><b>By</b> ".number_format($md5_endtime-$base64_endtime70'.''')." <b>seconds</b>.";
    
$query mysql_query("SELECT * FROM `base64_md5`");
    
$row mysql_fetch_array($query);
    
$newval $row['base64']+1;
    
mysql_query("UPDATE `base64_md5` SET `base64` = '$newval' WHERE `id` =0 LIMIT 1 ;");
}
echo 
"<center><b><br><br>Total Wins</b><hr></center><br><br>";
$query mysql_query("SELECT * FROM `base64_md5`");
????: NamePros.com http://www.namepros.com/showthread.php?t=199278
$row mysql_fetch_array($query);
echo 
"<b>MD5:</b> ".$row['md5']."<br>";
echo 
"<b>Base64:</b> ".$row['base64'];
echo 
"<br><br><b>Last Calculation:</b> ".$row['date'];
mysql_query("UPDATE `base64_md5` SET `date` = '".date("Y-m-d h:i:s")."' WHERE `id` =0 LIMIT 1 ;"); 
mysql_close();
Someone else from NamePros originally gave me this script. I can't remember who it was, sorry. I did make some modifications though.

Thanks to t.m. for the random characters function.

*Added database functionality to track wins/losses
Last edited by Tree; 05-27-2006 at 02:42 PM.
Tree is offline  
Old 05-27-2006, 03:54 PM THREAD STARTER               #35 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



nope... base64 is more efficient, it has won way more times...
Originally Posted by Tree
Just so you know, md5 is way more efficient than base64
nasaboy: I wan't using md5 as an encryption option, but merely explaining methods of storage I have used in the past.
????: NamePros.com http://www.namepros.com/showthread.php?t=199278

Tom
PoorDoggie is offline  
Old 05-27-2006, 06:52 PM   #36 (permalink)
NamePros Regular
 
Tree's Avatar
Join Date: Feb 2006
Location: Atlanta, GA, USA
Posts: 335
Tree will become famous soon enoughTree will become famous soon enough
 



Multiple instances of md5, I believe, is faster than multiple instances of base64. But it may be server-specific. I don't know. That's why I want people to try the code themselves.
Tree is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 12:42 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger