Bacon cipher: Difference between revisions
m
→Association tables
Cyril Nocton (talk | contribs) |
Cyril Nocton (talk | contribs) |
||
Line 1,023:
2. Program
<lang lisp>;; 22.06.
(defconstant +codes+
Line 1,048:
(setf code (cdr code)))
(setf cipher (append cipher (list c))))
(defun decode (text)
Line 1,060:
(setf key (append key (list (car (rassoc code +codes+ :test #'equal)))))
(setf code nil)))
3. Example
<lang lisp>(defconstant +monologue
"I've known adventures, seen places you people will never see, I've been Offw"
"orld and back... frontiers ! I've stood on the back deck of a blinker bound "
Line 1,072:
"en it, felt it..."))
(defconstant +
▲ "« Tears in rain »")</lang>
4. Execution
{{out}}
<pre>(encode +monologue
"I'VE knOwn ADveNtures, seEn plACes YoU PEoplE will NEvER SEe, i'Ve beEn offwoRl
d anD BaCK... FRon"
(decode (encode +monologue
" tears in rain "</pre>
|