How to encrypt a password on the client (AngularJS), send it to the server (expressJS) and decrypt it on the server?
<p>I want to encrypt a password on the client (angular.js), send it to the server (express.js) and decrypt it on the server. I would like a simple method. I use $http to POST requests.
I know that exits angular-bcrypt library and the same in nodeJS, but not worth for me, because it only has the method compare.</p>

<p>I want something like that:</p>

<pre><code>password = document.getElementById('txtPassword').value;
var xorKey = 129; /// you can have other numeric values also.
    var result = "";
    for (i = 0; i &lt; password.length; ++i) {
        result += String.fromCharCode(xorKey ^ password.charCodeAt(i));
    }
</code></pre>

<p>But,I only found the method for decrypting in c#:</p>

<pre><code>public bool Authenticate(string userName, string password)
    {
        byte result = 0;

        StringBuilder inSb = new StringBuilder(password);
        StringBuilder outSb = new StringBuilder(password.Length);
        char c;
        for (int i = 0; i &lt; password.Length; i++)
        {
            c = inSb[i];
            c = (char)(c ^ 129); /// remember to use the same XORkey value you used in javascript
            outSb.Append(c);
        }
        password = outSb.ToString();

       // your rest of code
    } 
</code></pre>

<p>Any idea? Thank you very much. :P</p>