Advertisement.

TransHimalaya.in

Everest Helicopter Tour for a day

Book exciting packages at www.transhimalaya.in

Simple Login Encryption in javascript and decryption in PHP

Simple Login Encryption in javascript and decryption in PHP
Solution wont show your username in plain text during transit but still It's possible to do man-in-the-middle attacks. for password encryption check http://vinodkotiya.blogspot.in/2012/08/change-or-encrypt-post-data-before.html
can be implemented through XoR.

simple Javascript Encryption code


function encryptUser(str) {

    var encoded = "";
    for (i=0; i
        var a = str.charCodeAt(i);
        var b = a ^ 6;    // bitwise XOR with any number, e.g. 123
        encoded = encoded+String.fromCharCode(b);
    }
    return encoded;
}

simple php Decryption function

function decryptUser($text)
{
 // Our output text
 $outText = '';

 // Iterate through each character
 for($i=0;$i
 {

         $outText .= chr(ord($text{$i}) ^ 6); // bitwise XOR with any number, e.g. 123

 }
 return $outText;

}

- Vinod Kotiya

Comments

Most Viewed Post

solution for facebook static.ak.fbcdn.net waiting

Connect Sony XPLOD MEX-BT2500 Bluetooth CD Receiver with ur mobile

Crystal Report : Show data horizontally (Left to right) i.e. columns as rows

Google+ Followers