2017-08-29 94 views
0
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 

我只知道,問題就來了在開始的數據類型,所以它會產生不同的結果。 我需要開始產生相同的結果,而不聲明(43ec3e5dee6e706af7766fffea512721)

+2

第一個值'begin'包含一些不可打印的字符,因爲你得到不同的結果。 – alexmac

回答

1

你是因爲你使用兩種不同的字符串得到不同的結果:\\075\075

+0

如何轉換。 \\ 075到\ 075? @destoryer – Juvenal