转换函数解密javascript到asp经典

时间:2011-03-06 13:37:14

标签: javascript asp-classic

我需要转换为asp经典的javascript函数,但我没有。

如果有人可以帮助我,我会很感激。

以下是代码:

<script type="text/javascript">
function decrypt(str, key1, key2) {

   var loc1 = [];

   for (var loc3 = 0; loc3 < str.length; ++loc3) {
      loc1.push(("000" + parseInt(str.charAt(loc3), 16).toString(2)).slice(-4));
   }

   loc1 = loc1.join("").split("");

   var loc6 = [];

   for (var loc3 = 0; loc3 < 384; ++loc3) {
      key1 = (key1 * 11 + 77213) % 81371;
      key2 = (key2 * 17 + 92717) % 192811;
      loc6[loc3] = (key1 + key2) % 128;
   }

   for (var loc3 = 256; loc3 >= 0; --loc3) {
      var loc5 = loc6[loc3];
      var loc4 = loc3 % 128;
      var loc8 = loc1[loc5];
      loc1[loc5] = loc1[loc4];
      loc1[loc4] = loc8;
   }

   for (var loc3 = 0; loc3 < 128; ++loc3) {
      loc1[loc3] = loc1[loc3] ^ loc6[loc3 + 256] & 1;
   }

   var loc12 = loc1.join("");
   var loc7 = [];

   for (var loc3 = 0; loc3 < loc12.length; loc3 = loc3 + 4) {
      var loc9 = loc12.substr(loc3, 4);
      loc7.push(loc9);
   }

   var loc2 = [];

   for (var loc3 = 0; loc3 < loc7.length; ++loc3) {
      loc2.push(parseInt(loc7[loc3], 2).toString(16));
   }
   return loc2.join("");
}
</script>

拜托,有人可以帮助我,谢谢你!感谢

1 个答案:

答案 0 :(得分:2)

您可以在服务器上运行javascript 将您的开始脚本标记更改为:

<script language="JScript" runat="server">

并尝试运行以查看结果