September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,19 +0,0 @@
|
|||
#lang racket
|
||||
|
||||
(define A (char->integer #\A))
|
||||
(define Z (char->integer #\Z))
|
||||
(define a (char->integer #\a))
|
||||
(define z (char->integer #\z))
|
||||
|
||||
(define (rotate c n)
|
||||
(define cnum (char->integer c))
|
||||
(define (shift base) (integer->char (+ base (modulo (+ n (- cnum base)) 26))))
|
||||
(cond [(<= A cnum Z) (shift A)]
|
||||
[(<= a cnum z) (shift a)]
|
||||
[else c]))
|
||||
|
||||
(define (caesar s n)
|
||||
(list->string (for/list ([c (in-string s)]) (rotate c n))))
|
||||
|
||||
(define (encrypt s) (caesar s 1))
|
||||
(define (decrypt s) (caesar s -1))
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
> (define s (encrypt "The five boxing wizards jump quickly."))
|
||||
> s
|
||||
"Uif gjwf cpyjoh xjabset kvnq rvjdlmz."
|
||||
> (decrypt s)
|
||||
"The five boxing wizards jump quickly."
|
||||
Loading…
Add table
Add a link
Reference in a new issue