Vigenère cipher: Difference between revisions

m
Line 947:
dec: BEWARETHEJABBERWOCKTHEJAWSTHATTHECLAWSTHATCATCH</pre>
 
====VariantAlternate version====
No string to circular list conversion.
 
Line 957:
(string-upcase (remove-if-not 'alpha-char-p s)))
 
(defun vigenere (texttxt key &key decode &aux (d (if decode -1 1)))
(let ((texttxt (strip texttxt)) (key (strip key)) (i -1))
(map 'string
(lambda (c)
(setf i (mod (1+ i) (length key)))
(char +a+ (mod (+ (position c +a+) (* d (position (elt key i) +a+))) 26)))
texttxt)))</lang>
 
2. Execution
422

edits