使用“CryptoJS"在Titanium移动项目的库中解密文本消息[三重DES]

Using "CryptoJS" library in a Titanium mobile project to decrypt a text message [Triple DES]

本文关键字:文本 解密 消息 DES 三重 项目 CryptoJS quot 移动 Titanium 使用      更新时间:2023-09-26

我有一个加密的文本消息,我想解密它使用"crypto-js"库张贴在链接:http://code.google.com/p/crypto-js/

我想使用三重DES解密。我下载了库,并将"tripledes.js"放在我项目的"lib"文件夹下。我以这种方式调用函数来解密:

var lib_decrypt = require('tripledes');
var message = lib_decrypt.DES.decrypt(Ti.Utils.base64decode(thetext), "secretphrase");
alert(message);

我总是得到这个错误:"Cannot call method 'decrypt' of undefined"。

我检查了"tripledes.js"代码,真诚地它是一个大库,所以我没有找到一个解决方案,如何使用这个库来解密我在钛中的文本。

提前感谢。

也许错误是你的对象你是否尝试创建一个实例或"tripledes"对象

 var decode = require('tripledes');
 var test = new decode();
 var message = test.DES.decrypt(Ti.Utils.base64decode(thetext), "secretphrase");

你也检查了tripledes.js是在钛CommonJS模块顺序?https://wiki.appcelerator.org/display/guides/CommonJS +模块+在+钛

出现问题是因为我错过了在"tripledes.js"中导出"CryptoJS"。所以当我输入"出口"时。在"tripledes.js"中,一切都工作得很好,因为所有tripledes库函数都与"CryptoJS"实例相关