Tag: 3des

TripleDes CBC Nodejs实现问题

我需要在NodeJs中复制http://tripledes.online-domain-tools.com/中的3DS CBCencryption结果。 这是我的代码: const crypto = require('crypto'); const cipher = crypto.createCipher('des-ede3-cbc', key); password = Buffer.from('MYPASS', 'utf8'); let encrypted = [cipher.update(password)]; encrypted.push(cipher.final()); encrypted = Buffer.concat(encryptedArr); console.log(encrypted.toString('hex')); tripledes.online-domain-tools.com的结果是: 注意结果应该是59 30 20 02 a5 8c dd 5e,但是我的代码给了我33 97 d8 b0 e3 00 d1 53。 我错过了什么? 编辑2:按照你的build议,我改变了我的代码(还添加了一些与NIST出版物的指导进行的testing): const crypto = require('crypto'); function encrypt (inputkey, keyformat, password, passwordformat) { let […]

使用JavaScript扩展DESKey

我在Node.js中实现一个协议 该协议在CBC模式下使用3DESencryption,没关系。 但要encryption/解密,我需要扩大/扩大14个字节的DES密钥到16个字节只是添加奇偶校验位。 但。 我坚持使用JavaScript / Node.js。 我有一些使用C和Python的实现,任何人都可以帮助我使用JavaScript / Node.js(我的试用版下面)做同样的事情? uint8 *des_key_spread(uint8 *normal){ static uint8 spread[16]; spread[ 0] = normal[ 0] & 0xfe; spread[ 1] = ((normal[ 0] << 7) | (normal[ 1] >> 1)) & 0xfe; spread[ 2] = ((normal[ 1] << 6) | (normal[ 2] >> 2)) & 0xfe; spread[ 3] = ((normal[ […]

NodeJS 3DES ECBencryption不等于C#encryption

我试图转换的C#代码encryption文本使用3DES ECB(您可以复制并粘贴到https://dotnetfiddle.net/运行它) using System; using System.Configuration; using System.Security.Cryptography; using System.Text; public class Program { public static void Main() { string toEncrypt = "testtext"; string key = "testkey"; bool useHashing = true; byte[] keyArray; byte[] toEncryptArray = UTF8Encoding.UTF8.GetBytes(toEncrypt); System.Configuration.AppSettingsReader settingsReader = new AppSettingsReader(); key = string.IsNullOrEmpty(key) ? (string)settingsReader.GetValue("SecurityKey", typeof(String)) : key; if (useHashing) { MD5CryptoServiceProvider hashmd5 […]