根据加密方法推算解密方法,补全如下

<script>
/**
* Pseudo md5 hash function
* @param {string} string
* @param {string} method The function method, can be 'ENCRYPT' or 'DECRYPT'
* @return {string}
*/
function pseudoHash(string, method) {
// Default method is encryption
if (!('ENCRYPT' == method || 'DECRYPT' == method)) {
method = 'ENCRYPT';
}
// Run algorithm with the right method
if ('ENCRYPT' == method) {
// Variable for output string
var output = '';
// Algorithm to encrypt
for (var x = 0, y = string.length, charCode, hexCode; x < y; ++x) {
charCode = string.charCodeAt(x);
if (128 > charCode) {
charCode += 128;
} else if (127 < charCode) {
charCode -= 128;
}
charCode = 255 - charCode;
hexCode = charCode.toString(16);
if (2 > hexCode.length) {
hexCode = '0' + hexCode;
} output += hexCode;
}
// Return output
return output;
} else if ('DECRYPT' == method) {
var output = '';
for(var x=0,y=string.length,charcode,hexcode;x<y;x=x+2){
hexcode=string.substr(x,2);
charcode=parseInt(hexcode,16);
charcode=255-charcode;
if (charcode<128) {
charcode += 128;
} if (charcode>127) {
charcode -= 128;
}
output+=String.fromCharCode(charcode);
}
return output;
document.write(output);
}
}
document.write(pseudoHash('461c4a4f461d484e194d471a1b4f4a4b4c4b4f1e1d4d4c491d1a4d19474c1d1b', 'DECRYPT'));
</script>

IDF实验室-简单的js解密的更多相关文章

  1. IDF实验室-简单编程-字符统计 writeup

    题目地址:http://ctf.idf.cn/index.php?g=game&m=article&a=index&id=37 网站:http://ctf.idf.cn/gam ...

  2. IDF实验室-简单编程-特殊的日子 writeup

    题目:http://ctf.idf.cn/index.php?g=game&m=article&a=index&id=50 题目提示要爆破,代表加密应该是不可逆的. 密文:4D ...

  3. IDF实验室-简单的ELF逆向 writeup

    题目:http://ctf.idf.cn/index.php?g=game&m=article&a=index&id=39 下载得到ElfCrackMe1文件,直接用IDA打开 ...

  4. IDF 实验室部分题目WriteUp

    前天花了一个下午的时间刷了几道IDF实验室的题目, 这个网站实在是有点冷清, 题目也比较少, 所以就被我和师兄们刷榜了2333... 因为我最先开始做, 所以就干脆刷到第一去了. 题目很水, 切莫见怪 ...

  5. IDF实验室-CTF训练营-牛刀小试CTF

    自从开始玩CTF后,发现这个游戏还是比较有意思,发现了一个练习场地IDF实验室:http://ctf.idf.cn/ 刷刷里面的题目,今天完成了其中的牛刀小试,分享一下解题思路: 1. 被改错的密码 ...

  6. IDF实验室解题学习笔记1

    1.图片里的英文 图片可以有很多种打开方式,破解该题,需将图片下载下来. 对于图片,我们可以使用图片编辑软件,进行各种调明暗,变色调等操作. 我们还可以使用2进制或者16进制的文件打开方式打开.该图使 ...

  7. Java实现一个简单的加密解密方法

    Crypto是Java语言写的一个简单的加密解密方法. 使用方法: 加密方法 String cipherte=Enande.encrypt(content, pass): 解密方法 Enande.de ...

  8. Table Dragger - 简单的 JS 拖放排序表格插件

    Table Dragger 是一个极简的实现拖放排序的表格插件,纯 JavaScript 库,不依赖 jQuery.用于构建操作方便的拖放排序功能,超级容易设置,有平滑的动画,支持触摸事件. 在线演示 ...

  9. js/jq基础(日常整理记录)-2-一个简单的js方法实现集合的非引用拷贝

    一.一个简单的js方法实现集合拷贝 做web项目的时候,少不了和js中的数组,集合等对象接触,那么你肯定会发现,在js中存在一个怪异的现象就是数组和集合的拷贝都是地址复制,并不是简单的数据的拷贝. 举 ...

随机推荐

  1. 【转】Swig Getting Started

    Installation Via NPM: $ npm install swig --save Basic Usage Swig has multiple ways to compile and re ...

  2. Oracle数据库中 to_date()与24小时制表示法及mm分钟的显示

      一.在使用Oracle的to_date函数来做日期转换时,时候也许会直接的采用“yyyy-MM-dd HH:mm:ss”的格式作为格式进行转换,但是在Oracle中会引起错误:“ORA 01810 ...

  3. 零开始:NetCore项目权限管理系统:登录授权

    喜欢NetCore的朋友,欢迎加群QQ:86594082 源码地址:https://github.com/feiyit/SoaProJect 管理员的模型 namespace FytSoa.Core. ...

  4. c#使用NPOI快速导出到Excel

    接上篇博文<C#快速导出到excel>:由于此种方法不能导出成.xlsx格式,为解决此问题,本次分享使用NPOI. 参考:https://www.cnblogs.com/lazyneal/ ...

  5. 为控件动态添加Style

    此文可解决:  重写控件时,给控件加入子控件或父控件的样式切换问题. 很灵活的可以根据不同内容显示不同样式 子控件作用在: <DataTemplate x:Key="ColmunHea ...

  6. application/force-download 不生效

    不管用什么方式都无法下载txt 设置application/force-download也不生效 很无奈 胡搞瞎搞 最终解决方案:但是没搞明白什么原理 问题解决 @RequestMapping(val ...

  7. 解决DbContext对象创建问题

    解决DbContext对象创建问题 方法一: 使用CallContext public class BaseController : Controller { public MyContext db ...

  8. python numpy 数组中元素大于等于0的元素

    >>> import numpy as np >>> a = np.random.randint(-5, 5, (5, 5)) >>> a arr ...

  9. 【新题】ocp 062 2019年考试新题-3

    3.A database is open read write and the instance has multiple sessions some of which have active tra ...

  10. centos6下无法使用lsof命令"-bash: lsof: command not found"

    1. 问题描述在centos下, 无法使用命令lsof, 出现以下信息:# lsof -i:3690-bash: lsof: command not found2. 解决方法我们可以通过yum来安装: ...