javascript - 创建正确的数据类型

标签 javascript node.js

function separateMd5(begin,end) {
    console.log("Begin: "+begin);


    // The variable begin, when encrypted, shows me the incorrect encryption
    console.log('With function hexMD5 begin: (Incorrect)');
    var encrypted = md5.hexMD5(begin);
    console.log(encrypted);

    // The correct encryption should be this:
    console.log("Declare begin and use function hexMD5 (Correct):")
    begin='\075';
    var encrypted = md5.hexMD5(begin);
    console.log(encrypted);

}

输出

Begin: \075
With function hexMD5 begin: (Incorrect)
27790613e018862f3b5b92b8d4f48f44
Declare begin and use function hexMD5 (Correct):
43ec3e5dee6e706af7766fffea512721

我只知道问题出在begin的数据类型上,所以它会产生不同的结果。 我需要开始生成相同的结果而不被声明(43ec3e5dee6e706af7766fffea512721)

最佳答案

您会得到不同的结果,因为您使用了两个不同的字符串:\\075\075

关于javascript - 创建正确的数据类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45942800/

相关文章:

javascript - react, typescript - 无状态和普通组件的类型

javascript - 如何使用 van Laarhoven Lens 删除对象的聚焦属性?

javascript - Laravel5 : Many to many relationship

javascript - 列表 : Observable on array map

javascript - promise 无序

javascript - 如何只选择一些 JSON 对象?

javascript - 如何从WinJS/javascript使用WebView控件navigateToLocalStreamUri

node.js - Passport JS 中的 req.isAuthenticated() 是如何实现的?

node.js - node进程内存占用,resident set size不断增加

javascript - 从命令行解析多个参数 Node.js/js