Skip to content

Instantly share code, notes, and snippets.

@mattbaker
Last active August 29, 2015 14:16
Show Gist options
  • Save mattbaker/f028895ac4b05e0cec23 to your computer and use it in GitHub Desktop.
Save mattbaker/f028895ac4b05e0cec23 to your computer and use it in GitHub Desktop.
Enigma racket encoding for @ltw
(define (encode reflector rotor-l rotor-m rotor-r letter)
(list-ref alphabet
(rotor-translate-right (rotate rotor-r 1)
(rotor-translate-right rotor-m
(rotor-translate-right rotor-l
(reflect reflector
(rotor-translate-left rotor-l
(rotor-translate-left rotor-m
(rotor-translate-left (rotate rotor-r 1)
(letter-to-index letter))))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment