iStriide Posted August 8, 2011 Share Posted August 8, 2011 Can you use md5 with the $_GET thingy and decode it on the page your getting linked to. I'll try and put and example of what i'm trying to say. <?php $link = md5($random); // I'm not sure on how md5 is setup that goes. echo " <a href='random.php?xyz=$link'>Click here yo!</a> "; ?> Then after you reached the link page then can you decode the $_GET and then use it to query a database? Quote Link to comment https://forums.phpfreaks.com/topic/244273-_get-and-md5-question/ Share on other sites More sharing options...
AyKay47 Posted August 8, 2011 Share Posted August 8, 2011 can't decode md5, you can however compare the md5 result with an md5 hashed version of the correct value.. your code looks correct for what you want to do Quote Link to comment https://forums.phpfreaks.com/topic/244273-_get-and-md5-question/#findComment-1254614 Share on other sites More sharing options...
iStriide Posted August 8, 2011 Author Share Posted August 8, 2011 Are their any encoders that you can actually decode? Quote Link to comment https://forums.phpfreaks.com/topic/244273-_get-and-md5-question/#findComment-1254618 Share on other sites More sharing options...
AyKay47 Posted August 8, 2011 Share Posted August 8, 2011 you can "crack" it yes, but decode no Quote Link to comment https://forums.phpfreaks.com/topic/244273-_get-and-md5-question/#findComment-1254619 Share on other sites More sharing options...
iStriide Posted August 8, 2011 Author Share Posted August 8, 2011 How would you "Crack" it? Quote Link to comment https://forums.phpfreaks.com/topic/244273-_get-and-md5-question/#findComment-1254621 Share on other sites More sharing options...
KevinM1 Posted August 8, 2011 Share Posted August 8, 2011 There's a difference between hashing and encrypting. Hashing is designed to be one-way. Encryption is designed with the assumption that the thing being encrypted will eventually be decrypted. MD5, SHA, etc. are hash algorithms. Quote Link to comment https://forums.phpfreaks.com/topic/244273-_get-and-md5-question/#findComment-1254622 Share on other sites More sharing options...
AyKay47 Posted August 8, 2011 Share Posted August 8, 2011 why would you want to hash a query string in the first place? Quote Link to comment https://forums.phpfreaks.com/topic/244273-_get-and-md5-question/#findComment-1254625 Share on other sites More sharing options...
Psycho Posted August 8, 2011 Share Posted August 8, 2011 How would you "Crack" it? You don't. What he is stating has nothing to do with what you want to accomplish. Can you give some details about the values that you want to hash/encrypt? If it is a relatively small finite list, then you could build a lookup list of the values and their hash values. But, if the list of possible values is large then you could use Mcrypt (http://php.net/manual/en/book.mcrypt.php). But, depending upon how "secure" this value needs to be you could also consider building yourself a simple ceasar cypher. It would be helpful to know how the value of "$random" is determined. Quote Link to comment https://forums.phpfreaks.com/topic/244273-_get-and-md5-question/#findComment-1254626 Share on other sites More sharing options...
WebStyles Posted August 9, 2011 Share Posted August 9, 2011 I guess the whole point here (of the original post) was passing a variable to the next page without it being in plain sight ( ? ). If so, you can simply store it in a $_SESSION variable and retrieve it on the next page. If you want it to look cool and encrypted, you can use your md5 hash as a session variable name: If they're links you wish to send out in emails, that are supposed to be unique, you can do the same thing, but store the hashes and values in a database instead of session. <?php session_start(); $link = md5($random); // I'm not sure on how md5 is setup that goes. $_SESSION[$link] = $random; echo "<a href='random.php?xyz=$link'>Click here yo!</a>"; ?> on next page, you can retrieve the value of $random with: <?php session_start(); echo $_SESSION[$_GET['xyz']]; ?> Quote Link to comment https://forums.phpfreaks.com/topic/244273-_get-and-md5-question/#findComment-1254752 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.