MCPcopy Index your code
hub / github.com/dmarman/sha256algorithm / paddingExplained

Function paddingExplained

src/classes/utils.js:90–98  ·  view source on GitHub ↗
(input, base = 'text')

Source from the content-addressed store, hash-verified

88}
89
90export 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
100export function chunkString(str, length = 512) {
101 return str.match(new RegExp('.{1,' + length + '}', 'g')) || [];

Callers 1

Explainer.jsFile · 0.90

Calls 5

stringToBinaryFunction · 0.70
calculateKFunction · 0.70
return64BitFunction · 0.70
decimalToBinaryFunction · 0.70
appendOneBitFunction · 0.70

Tested by

no test coverage detected