- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当使用 crypto js tripleDES 进行加密时,我注意到所有要加密的字符串都很短,例如“01”、“111”、“20”正确加密,但对于长字符串,如“5000021234567890000”,输出是' t 正确或不是我期望的值。例如对于这个“5000021234567890000”,我期待这个:“HctDaKc/U9avOwZMSS5mEi62kfojDHA4”但我得到这个:HctDaKc/U9bNnFy6eZHqHj3SemorJxQM.
这是我找到并用来加密的代码
let key = CryptoJS.MD5(enckey);
key.words[4] = key.words[0];
key.words[5] = key.words[1];
let iv = CryptoJS.lib.WordArray.create(64/8);
CryptoJS.TripleDES.encrypt("5000021234567890000", key, {iv: iv});
非常感谢您的帮助。
最佳答案
查看加密数据,第一个 block 匹配,后面两个 block 不匹配。
HctDaKc/U9avOwZMSS5mEi62kfojDHA4 1DCB4368A73F53D6 AF3B064C492E6612 2EB691FA230C7038 HctDaKc/U9bNnFy6eZHqHj3SemorJxQM 1DCB4368A73F53D6 CD9C5CBA7991EA1E 3DD27A6A2B27140C
The IV is presumably all 0x00 bytes.
THis indicates one is using ECB m ode and the other is using CBC mode.
See Block cipher mode of operation, specifically ECB and CBC modes.
ECB mode encrypted each block independly, CBC mode xors the previous block with the data to be encrypted and for the first block the IV. Since the IV is all 0x00 values no change is made to the first block.
Options can be specified in the createion of the encryptor, you need to see the documentation page, good luck with that.
It would look something like:
encryptor = crypto.createCipheriv( mode, key, iv)
其中模式是以下之一:'des-ede'、'des-ede-cbc'、'des-ede3'、'des-ede3-cbc'、'des3'
关于javascript - 加密 JS : TripleDES not encrypting properly,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44436943/
我正在尝试停止使用 CAPICOM,因为我不能再使用它(64 位 Windows 7 机器)。 现有的使用TripleDES的代码是这样的: EncryptedDataClass cryptic =
我有一个使用 Triple DES 加密和解密数据的代码。代码一切正常。 我对 Triple Des 有疑问。Triple DES 在执行加密过程时会改变数据大小。我用谷歌搜索,对得到的答案感到非常困
我有一个 TripleDESCng 的工作实现(针对一些测试向量进行了测试),但是发生了以下情况: 当我加密纯文本时 这是一个示例消息(24 字节,因此它是 3 个 block )(十六进制为 546
我正在尝试使用 tripleDes 解密数据。一切看起来都很好,但它的开头有一些无效字符?我究竟做错了什么?对于相同的数据,如果多次调用此函数,前几个字符总是不同的,但其余数据是相同的。 我将 use
我现在了解到 PasswordDeriveBytes 已被弃用,取而代之的是 Rfc2898DeriveBytes。在 MSDN 上查找 Rfc2898DeriveBytes。有一个使用 Triple
我正在尝试使用 MYSQL 方法使用值为“symmetric_encryption.php”的 key 加密字符串(仅作为示例)。然而,输出是其他密码无法理解的垃圾。我尝试了一切,但无论如何它都会产生
有人可以给我在 C# 中加密和解密大文件的代码或有值(value)的建议吗? 我正在尝试使用 TripleDES 来做到这一点。它应该是安全、快速和可靠的这里应该根据我的 key 完成加密和解密。 最
我正在尝试将一些项目从 .net framework 4.5 迁移到 .net core。尝试迁移旧的crypting/decrypting 方法时会出现问题。该方法是一个 TripleDES,其 k
我有一组来自远程系统的用 TripleDES 编码的加密文档。我需要在 C# 中解码数据,但我无法控制 key 或编码算法。我所拥有的只是 key 和模式 (CBC) 以及文件中的数据。 Triple
根据Wikipedia的说法,TripleDES支持56、112和168位 key 长度,但是System.Cryptography.TripleDESCryptoServiceProvider.Le
我一直在从事我的科学项目,当时我想做一个实验,通过暴力破解来测试 TripleDES 的安全性。 TripleDES 由三个 key 组成,每个 key 56 位(加上 8 个奇偶校验位),其中每个
所以当我说这样的话时: TripleDES tripledes = TripleDES.Create(); Rfc2898DeriveBytes pdb = new Rfc2898DeriveByte
最近出现了一个问题,涉及将 API 与支付处理器连接,该支付处理器请求使用 TripleDES 标准对字符串进行加密以用作 token 。我们的应用程序使用 ColdFusion 运行,它有一个加密标
我正在使用 CryptoJS 库来实现 TripleDES 功能,但解密数据不起作用。我解密的数据不返回原始字符串。 var t = "a"; var d = "john"; var key = Cr
我有一个简单的java Web应用程序,它是由apache wicket构建的。当我在网络应用程序中注册用户时,我使用三元组对他们输入的密码进行加密并将其保存到数据库中。在登录页面,当他们输入相同的密
当使用 crypto js tripleDES 进行加密时,我注意到所有要加密的字符串都很短,例如“01”、“111”、“20”正确加密,但对于长字符串,如“5000021234567890000”,
我正在尝试使用 TripleDES.js 在 JavaScript 中加密和解密。这是我的代码片段: 加密方法: encrypt_string = function (plainData) {
我有一个示例 Java 函数,想为 PHP 做一个类似的函数: public static string Encrypt(string plainText, string key) {
我有一个 C# 应用程序,它使用以下方法在数据库中加密和解密密码: public static string Encrypt(string input, string key) { Tripl
我需要在 Nodejs 中复制 http://tripledes.online-domain-tools.com/ 中 3DS CBC 加密的结果。 这是我的代码: const crypto = re
我是一名优秀的程序员,十分优秀!