user8530888
user8530888

Reputation:

Create correct data types

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);

}

OUTPUT

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

I just know that the problem comes in the data type of begin, so it generates different results. I need begin to generate the same results without being declared (43ec3e5dee6e706af7766fffea512721)

Upvotes: 0

Views: 54

Answers (1)

pishpish
pishpish

Reputation: 2614

You are getting different results because you're using two different strings: \\075 and \075.

Upvotes: 1

Related Questions