| 118 | } |
| 119 | |
| 120 | function convertToWordArray(string) { |
| 121 | let lWordCount; |
| 122 | let lMessageLength = string.length; |
| 123 | let lNumberOfWordsTemp1 = lMessageLength + 8; |
| 124 | let lNumberOfWordsTemp2 = (lNumberOfWordsTemp1 - (lNumberOfWordsTemp1 % 64)) / 64; |
| 125 | let lNumberOfWords = (lNumberOfWordsTemp2 + 1) * 16; |
| 126 | let lWordArray = new Array(lNumberOfWords - 1); |
| 127 | let lBytePosition = 0; |
| 128 | let lByteCount = 0; |
| 129 | while (lByteCount < lMessageLength) { |
| 130 | lWordCount = (lByteCount - (lByteCount % 4)) / 4; |
| 131 | lBytePosition = (lByteCount % 4) * 8; |
| 132 | lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition)); |
| 133 | lByteCount++; |
| 134 | } |
| 135 | lWordCount = (lByteCount - (lByteCount % 4)) / 4; |
| 136 | lBytePosition = (lByteCount % 4) * 8; |
| 137 | lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition); |
| 138 | lWordArray[lNumberOfWords - 2] = lMessageLength << 3; |
| 139 | lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29; |
| 140 | return lWordArray; |
| 141 | } |
| 142 | |
| 143 | function wordToHex(lValue) { |
| 144 | let wordToHexValue = '', |