(function() {
    function HexParsr() {
        // private property
        var _paddingLeft = "sha256$" + Math.random().toString(36).slice(2, 8);
        var _paddingRight = Math.random().toString(36).slice(2, 8) + "=";

        b64EncodeUnicode = function(str){
          return window.btoa(
            encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function(match, p1) {
                return String.fromCharCode('0x' + p1);
            })
          );
        }

        p_encode = function(secret_password) {
            return _paddingLeft + secret_password + _paddingRight;
        }

        this.xyz = function(password){
            return p_encode(window.btoa(_paddingLeft + b64EncodeUnicode(password) + _paddingRight));
        }
    }

    $(function(){
      var p_field=$("#id_auth-password");
      p_field.parents("form")[0].onsubmit = function(){
        p_encoder = new HexParsr();
        p_field.val(p_encoder.xyz(p_field.val()));
      };
    });
})();
@@ -278,33 +278,8 @@
 urn 
-window.btoa(%0A            
 enco
@@ -416,23 +416,9 @@
     
-  %7D)%0A          
+%7D
 );%0A 
@@ -435,24 +435,31 @@
         
-p_encode
+this.addPadding
  = funct
@@ -572,19 +572,22 @@
    this.
-xyz
+encode
  = funct
@@ -599,16 +599,17 @@
 assword)
+ 
 %7B%0A      
@@ -618,93 +618,150 @@
     
-return p_encode(window.btoa(_paddingLeft + b64EncodeUnicode(password) + _paddingRight
+var secret_password = this.addPadding(window.btoa(b64EncodeUnicode(password)));%0A            return this.addPadding(window.btoa(secret_password
 ));%0A
@@ -806,16 +806,23 @@
    var p
+assword
 _field=$
@@ -847,24 +847,31 @@
 d%22);%0A      p
+assword
 _field.paren
@@ -916,16 +916,23 @@
        p
+assword
 _encoder
@@ -959,16 +959,23 @@
        p
+assword
 _field.v
@@ -978,16 +978,23 @@
 ld.val(p
+assword
 _encoder
@@ -998,13 +998,23 @@
 der.
-xyz(p
+encode(password
 _fie

update js for better naming