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

Method wiringFromPlugboardValue

src/Encoder/Enigma.js:847–854  ·  view source on GitHub ↗

* Converts plugboard value to rotor wiring string. * @protected * @param {string} plugboard String with pairs of letters to be swapped * @return {string} Rotor wiring

(plugboard)

Source from the content-addressed store, hash-verified

845 * @return {string} Rotor wiring
846 */
847 wiringFromPlugboardValue (plugboard) {
848 const wiring = alphabet.split('')
849 plugboard.split(' ').forEach(pair => {
850 wiring[pair.charCodeAt(0) - 97] = pair[1]
851 wiring[pair.charCodeAt(1) - 97] = pair[0]
852 })
853 return wiring.join('')
854 }
855
856 /**
857 * Returns true, if the brick input is randomizable.

Callers 1

performTranslateMethod · 0.95

Calls 2

splitMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected