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

Function padding

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

Source from the content-addressed store, hash-verified

78}
79
80export function padding(input, base = 'text') {
81 if(base === 'text') input = stringToBinary(input);
82 if(base === 'hex') input = hexToBinary(input);
83 let L = input.length;
84 let K = calculateK(L);
85 let L64 = return64Bit(decimalToBinary(L));
86
87 return appendOneBit(input) + L64.padStart(K + 64, '0')
88}
89
90export function paddingExplained(input, base = 'text') {
91 if(base === 'text') input = stringToBinary(input);

Callers 3

App.jsFile · 0.90
onInputChangeFunction · 0.90
shaSteppedFunction · 0.90

Calls 6

hexToBinaryFunction · 0.85
stringToBinaryFunction · 0.70
calculateKFunction · 0.70
return64BitFunction · 0.70
decimalToBinaryFunction · 0.70
appendOneBitFunction · 0.70

Tested by

no test coverage detected