Encrypt and Decrypt data in PHPVineet Kumar Saini14yAsked Apr 16, 2012, 8:34 AM EDT2 answersShareLinkedInXCopy linkSaveHiI want to know how to encrypt and decrypt data in MySql in PHP ? Please tell me anyone with an example ?Thanks
Encrypt and Decrypt data in PHPVineet Kumar Saini14yAsked Apr 16, 2012, 8:34 AM EDT2 answersShareLinkedInXCopy linkSaveHiI want to know how to encrypt and decrypt data in MySql in PHP ? Please tell me anyone with an example ?Thanks
Satyapriya NayakRank #47 · 31.5K reputation14y agoPosted Apr 16, 2012, 9:28 AM EDT0Hi Vineet,Please refer the below linkshttp://www.website-security-tools.com/index.php/Secure-Persisted-Data-With-PHP/encrypt-and-decrypt-data-stored-in-a-mysql-database-using-php-and-two-way-encryption.htmlhttp://techpad.co.uk/content.php?sid=82Thanks0
SenthilkumarRank #387 · 6.5K reputation14y agoPosted Apr 16, 2012, 8:02 PM EDT0Hi Vineet,For example of encrypt and decrypt the urls:function encrypt($sData, $sKey='mysecretkey'){ $sResult = ''; for($i=0;$i $sChar = substr($sData, $i, 1); $sKeyChar = substr($sKey, ($i % strlen($sKey)) - 1, 1); $sChar = chr(ord($sChar) + ord($sKeyChar)); $sResult .= $sChar; } return encode_base64($sResult); } function decrypt($sData, $sKey='mysecretkey'){ $sResult = ''; $sData = decode_base64($sData); for($i=0;$i $sChar = substr($sData, $i, 1); $sKeyChar = substr($sKey, ($i % strlen($sKey)) - 1, 1); $sChar = chr(ord($sChar) - ord($sKeyChar)); $sResult .= $sChar; } return $sResult; } function encode_base64($sData){ $sBase64 = base64_encode($sData); return strtr($sBase64, '+/', '-_'); } function decode_base64($sData){ $sBase64 = strtr($sData, '-_', '+/'); return base64_decode($sBase64); } similarly there are lot of examples,http://www.99points.info/2010/06/php-encrypt-decrypt-functions-to-encrypt-url-data/ http://www.codingforums.com/showthread.php?t=187938 0Join to answer this questionEvery answer you publish earns 20 SHARP.Create free accountSign inKnow the answer?Answer a question in the forums and earn +20 SHARP for every answer.See unanswered questionsForumsTop experts01Arun PottiAnswers in the forums20answers02Tahir AnsariAnswers in the forums5answers03Kamlesh KumarAnswers in the forums5answers04Sam HobbsAnswers in the forums4answers05Željko PerićAnswers in the forums3answers?YouYour name goes here.Every answer: 20 SHARP.JoinFull leaderboard →2026DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted Apr 16, 2012, 9:28 AM EDT
Please refer the below links
http://www.website-security-tools.com/index.php/Secure-Persisted-Data-With-PHP/encrypt-and-decrypt-data-stored-in-a-mysql-database-using-php-and-two-way-encryption.html
http://techpad.co.uk/content.php?sid=82
Thanks
SenthilkumarRank #387 · 6.5K reputationPosted Apr 16, 2012, 8:02 PM EDT
For example of encrypt and decrypt the urls:
similarly there are lot of examples,
http://www.99points.info/2010/06/php-encrypt-decrypt-functions-to-encrypt-url-data/
http://www.codingforums.com/showthread.php?t=187938
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts