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

Function onInputChange

src/App.js:116–135  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

114 }
115
116 function onInputChange(value) {
117 if(inputBase === 'bin' && !['0', '1', ''].includes(value.substr(-1))) return;
118 if(inputBase === 'hex' && !['a', 'b', 'c', 'd', 'e', 'f', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ''].includes(value.substr(-1))) return;
119 if(clock > lastClock()) setClock(lastClock());
120
121 setInput(value);
122 setPaddedInput(padding(value, inputBase));
123
124 if(clock === 0) value = '';
125 let result = shaStepped(value, firstLoop(clock), secondLoop(clock), chunksLoop(clock));
126
127 setWView(result.w);
128 setResult(result.hash);
129 setHs(result.hs);
130 setHsBefore(result.hsBefore);
131 setLetters(result.letters);
132 setLettersBefore(result.lettersBefore);
133
134 ReactGA.event('onInputChange');
135 }
136
137 function onClockFast() {
138 if(clock + 10 > lastClock()) return;

Callers

nothing calls this directly

Calls 6

paddingFunction · 0.90
lastClockFunction · 0.85
shaSteppedFunction · 0.85
firstLoopFunction · 0.85
secondLoopFunction · 0.85
chunksLoopFunction · 0.85

Tested by

no test coverage detected