Toolfk程序员工具箱

JavaScript实现在线MD5、SHA、AES、Rabit

2018-11-21  本文已影响1人  TOOLFK

 本文要推荐的[ToolFk]是一款程序员经常使用的线上免费测试工具箱,ToolFk 特色是专注于程序员日常的开发工具,不用安装任何软件,只要把内容贴上按一个执行按钮,就能获取到想要的内容结果。ToolFk还支持BarCode条形码在线生成、 QueryList采集器、 PHP代码在线运行、 PHP混淆、加密、解密、 Python代码在线运行JavaScript在线运行YAML格式化工具HTTP模拟查询工具HTML在线工具箱JavaScript在线工具箱CSS在线工具箱JSON在线工具箱Unixtime时间戳转换Base64/URL/Native2Ascii转换CSV转换工具箱XML在线工具箱WebSocket在线工具Markdown 在线工具箱Htaccess2nginx 转换进制在线转换在线加密工具箱在线伪原创工具在线APK反编译在线网页截图工具在线随机密码生成在线生成二维码Qrcode在线Crontab表达式生成在线短网址生成在线计算器工具。等20多个日常程序员开发工具,算是一个非常全面的程序员工具箱网站。

網站名稱:ToolFk

網站鏈結:https://www.toolfk.com/

工具链接:https://www.toolfk.com/tool-convert-encryption

代码教學

本工具[在线MD5、SHA、AES、Rabit 、RC4、TripleDES Ripemd160 加密解密工具]依赖的代码库为 https://github.com/brix/crypto-js

STEP 1

STEP 2

核心代码如下

function md5_encode(key,message){

    return CryptoJS.MD5(key+message).toString();

}

function macmd5_encode(key,message){

    return CryptoJS.HmacMD5(message,key).toString();

}

function ase_encode(key,message){

    return CryptoJS.AES.encrypt(message, key).toString();

}

function ase_decode(key,message){

    var decryptResult  = CryptoJS.AES.decrypt(message, key);

    return decryptResult.toString(CryptoJS.enc.Utf8);

}

function des_encode(key,message){

    toolfk.report('des_encode',key+":"+message);

    return CryptoJS.DES.encrypt(message, key).toString();

}

function des_decode(key,message){

    var decryptResult= CryptoJS.DES.decrypt(message, key);

    return decryptResult.toString(CryptoJS.enc.Utf8);

}

function rabit_encode(key,message){

    return CryptoJS.Rabbit.encrypt(message, key).toString();

}

function rabit_decode(key,message){

    var decryptResult = CryptoJS.Rabbit.decrypt(message, key);

    return decryptResult.toString(CryptoJS.enc.Utf8);

}

function rabit_legacy_encode(key,message){

    return CryptoJS.RabbitLegacy.encrypt(message, key).toString();

}

function rabit_legacy_decode(key,message){

    var decryptResult= CryptoJS.RabbitLegacy.decrypt(message, key);

    return decryptResult.toString(CryptoJS.enc.Utf8);

}

function sha1_encode(key,message){

    return CryptoJS.SHA1(key+message).toString();

}

function sha224_encode(key,message){

    return CryptoJS.HmacSHA224(message,key).toString();

}

function sha256_encode(key,message){

    return CryptoJS.SHA256(key+message).toString();

}

function sha384_encode(key,message){

    return CryptoJS.HmacSHA384(message,key).toString();

}

function sha512_encode(key,message){

    return CryptoJS.SHA512(key+message).toString();

}

function sha3_encode(key,message){

    return CryptoJS.SHA3(key+message).toString();

}

function tripledes_encode(key,message){

    return CryptoJS.TripleDES.encrypt(message, key).toString();

}

function tripledes_decode(key,message){

    var decryptResult= CryptoJS.TripleDES.decrypt(message, key);

    return decryptResult.toString(CryptoJS.enc.Utf8);

}

function rc4_encode(key,message){

    return CryptoJS.RC4.encrypt(message, key).toString();

}

function rc4_decode(key,message){

    var decryptResult= CryptoJS.RC4.decrypt(message, key);

    return decryptResult.toString(CryptoJS.enc.Utf8);

}

function rc4drop_encode(key,message){

    return CryptoJS.RC4Drop.encrypt(message, key).toString();

}

function rc4drop_decode(key,message){

    var decryptResult= CryptoJS.RC4Drop.decrypt(message, key);

    return decryptResult.toString(CryptoJS.enc.Utf8);

}

function ripemd160_encode(key,message){

    return CryptoJS.RIPEMD160(key+message).toString();

}

function hmac_piremd160_encode(key,message){

    return CryptoJS.HmacRIPEMD160(message,key).toString();

}

值得一試的三個理由:

整合各種程序员开发中经常使用的开发测试工具。

简洁美观大气的网站页面

支持 在线格式化执行代码、APK在线反编译、在线高强度密码生成、在线网页截图 等二十多種工具服务

同时还推荐一下它的姐妹网www.videofk.com视频下载工具箱

本文链接:http://www.hihubs.com/article/377

上一篇下一篇

猜你喜欢

热点阅读