(input, base = 'text')
| 88 | } |
| 89 | |
| 90 | export function paddingExplained(input, base = 'text') { |
| 91 | if(base === 'text') input = stringToBinary(input); |
| 92 | let L = input.length; |
| 93 | let K = calculateK(L); |
| 94 | let L64 = return64Bit(decimalToBinary(L)); |
| 95 | let result = appendOneBit(input) + L64.padStart(K + 64, '0'); |
| 96 | |
| 97 | return { input, L, LBinary: decimalToBinary(L), K, L64, result, inputAppended: appendOneBit(input) }; |
| 98 | } |
| 99 | |
| 100 | export function chunkString(str, length = 512) { |
| 101 | return str.match(new RegExp('.{1,' + length + '}', 'g')) || []; |
no test coverage detected