MCPcopy Create free account
hub / github.com/cryptii/cryptii / rotorAtTurnover

Method rotorAtTurnover

src/Encoder/Enigma.js:758–764  ·  view source on GitHub ↗

* Checks if given rotor has a turnover at given position. * @protected * @param {object} rotor Rotor entry * @param {number} position Rotor position * @return {boolean} True, if rotor has a turnover at given position

(rotor, position)

Source from the content-addressed store, hash-verified

756 * @return {boolean} True, if rotor has a turnover at given position
757 */
758 static rotorAtTurnover (rotor, position) {
759 if (rotor.turnovers === undefined) {
760 return false
761 }
762 const positionChar = String.fromCharCode(97 + MathUtil.mod(position, 26))
763 return rotor.turnovers.indexOf(positionChar) !== -1
764 }
765
766 /**
767 * Wires character index (0-25) through given rotor at given position.

Callers 1

performTranslateMethod · 0.80

Calls 2

modMethod · 0.80
indexOfMethod · 0.80

Tested by

no test coverage detected