Skip to content

Instantly share code, notes, and snippets.

@elderica
Created February 6, 2022 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elderica/a314157a89293838cb7e584d9148e7a9 to your computer and use it in GitHub Desktop.
Save elderica/a314157a89293838cb7e584d9148e7a9 to your computer and use it in GitHub Desktop.
#lang racket/base
(require [only-in srfi/13 string-index])
(define alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
(define table
(for/list ([i (in-range 26)])
(string-append
(substring alphabet i)
(substring alphabet 0 i))))
(define key "SOLVECRYPTO")
(define code "UFJKXQZQUNB")
(list->string
(for/list ([k (in-string key)]
[c (in-string code)])
(string-ref alphabet
(string-index (list-ref table (string-index alphabet k))
c))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment