Skip to content

Instantly share code, notes, and snippets.

@LHazy
Created September 29, 2014 13:18
Show Gist options
  • Save LHazy/ac5f010d6cea861d1d3e to your computer and use it in GitHub Desktop.
Save LHazy/ac5f010d6cea861d1d3e to your computer and use it in GitHub Desktop.
ksnctfの第2問を解くためのスクリプト
(define (ksnctf-q2-decode str)
(define (decode c)
(let ((s (x->string c)))
(if (rxmatch #/[a-zA-Z]/ s)
(if (rxmatch #/[a-mA-M]/ s)
(integer->char (+ (char->integer c) 26 -13))
(integer->char (- (char->integer c) 13)))
c)))
(list->string (map decode (string->list str))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment