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

Method getRotor

src/Encoder/Enigma.js:953–967  ·  view source on GitHub ↗

* Returns a rotor entry by given name. * @protected * @param {string} name Rotor name * @return {?object} Rotor entry or null if not found.

(name)

Source from the content-addressed store, hash-verified

951 * @return {?object} Rotor entry or null if not found.
952 */
953 static getRotor (name) {
954 if (rotorMap === null) {
955 // Read rotor table and build map lazily
956 rotorMap = {}
957 let i, j, rotor
958 for (i = 0; i < rotorTable.length; i += rotorTableColumns.length) {
959 rotor = {}
960 for (j = 0; j < rotorTableColumns.length; j++) {
961 rotor[rotorTableColumns[j]] = rotorTable[i + j]
962 }
963 rotorMap[rotor.name] = rotor
964 }
965 }
966 return rotorMap[name] || null
967 }
968
969 /**
970 * Maps given names to rotor entries.

Callers 2

performTranslateMethod · 0.80
getRotorsMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected