MCPcopy
hub / github.com/wensonsmith/YoudaoTranslator / ConvertToWordArray

Function ConvertToWordArray

src/libs/md5.js:53–74  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

51 };
52
53 function ConvertToWordArray(string) {
54 var lWordCount;
55 var lMessageLength = string.length;
56 var lNumberOfWords_temp1=lMessageLength + 8;
57 var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64;
58 var lNumberOfWords = (lNumberOfWords_temp2+1)*16;
59 var lWordArray=Array(lNumberOfWords-1);
60 var lBytePosition = 0;
61 var lByteCount = 0;
62 while ( lByteCount < lMessageLength ) {
63 lWordCount = (lByteCount-(lByteCount % 4))/4;
64 lBytePosition = (lByteCount % 4)*8;
65 lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount)<<lBytePosition));
66 lByteCount++;
67 }
68 lWordCount = (lByteCount-(lByteCount % 4))/4;
69 lBytePosition = (lByteCount % 4)*8;
70 lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80<<lBytePosition);
71 lWordArray[lNumberOfWords-2] = lMessageLength<<3;
72 lWordArray[lNumberOfWords-1] = lMessageLength>>>29;
73 return lWordArray;
74 };
75
76 function WordToHex(lValue) {
77 var WordToHexValue="",WordToHexValue_temp="",lByte,lCount;

Callers 1

md5Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected