ASP 암호화 하기

function form_submit() {

  var letters = 'ghijklabvwxyzABCDEFef)_+|<>?:mnQRSTU~!@#$%^VWXYZ`1234567opGHIJKLu./;'+"'"+'[]MNOP890-='+'\\'+'&*("{},cdqrst'+"\n";
  var split = letters.split("");
  var num = '';
  var encrypted = '';
 
<%
  if f_jumin = 1 then
%>

  encrypted = '';
  var it = document.ps_user.jumin2.value;
  var c = '';
  var b = '0';
  var chars = it.split("");
  while(b<it.length)
  {c = '0';while(c<letters.length)
  {if(split[c] == chars[b])
  {if(c == "0") { c = ""; }
  if(eval(c+10) >= letters.length){
  num = eval(10-(letters.length-c));
  encrypted += split[num];}
  else{num = eval(c+10);encrypted += split[num];}
  }
  c++;}
  b++;}

  document.ps_user.jumin2.value = encrypted;encrypted = ''; 

<%
  end if
%>

  encrypted = '';
  var c1 = '';
  var it1 = document.ps_user.pin.value;
  var b1 = '0';
  var chars1 = it1.split("");
  while(b1<it1.length){c1 = '0';
  while(c1<letters.length){if(split[c1] == chars1[b1]){if(c1 == "0") { c1 = ""; }if(eval(c1+10) >= letters.length){num = eval(10-(letters.length-c1));
  encrypted += split[num];}else{num = eval(c1+10);encrypted += split[num];}}c1++;}b1++;}document.ps_user.pin.value = encrypted;encrypted = '';

  document.ps_user.submit();
}

-------------------------------------------------------------------------------------------------------------------------

  var encrypted = '';
  var it = document.ps.pin.value;
  var b = '0';var chars = it.split("");
  while(b<it.length) {
       c = '0';
       while(c<letters.length)
          {if(split[c] == chars[b])
     {if(c == "0") { c = ""; }
     if(eval(c+10) >= letters.length)
      {num = eval(10-(letters.length-c));
      encrypted += split[num];}else{num = eval(c+10);
      encrypted += split[num];}
      }
      c++;
      }
      b++;
      }document.ps.pin.value = encrypted;encrypted = '';
---------------------------------------------------------------------------------------------------------------------

역변환

<script>
function decode_letters(it){

    var letters = 'ghijklabvwxyzABCDEFef)_+|<>?:mnQRSTU~!@#$%^VWXYZ`1234567opGHIJKLu./;'+"'"+'[]MNOP890-='+'\\'+'&*("{},cdqrst'+"\n";

    var split = letters.split("");
    var num = '';
    var c = '';

    var decrypted = '';

    var b = '0';
    var chars = it.split("");
    while(b<it.length){
        c = '0';
        while(c<letters.length){
            if(split[c] == chars[b]){
                if(c == "0") { c = ""; }
                if(eval(c-10) < 0){
                    num = eval(letters.length+(c-10));
                    decrypted += split[num];
                }else{
                    num = eval(c-10);
                    decrypted += split[num];
                }
            }
            c++;
        }
        b++;
    }
 alert(decrypted);
    return decrypted;

}
</script>

2009/05/19 21:30 2009/05/19 21:30

Trackback Address :: 이 글에는 트랙백을 보낼 수 없습니다