And another, 'abstracted' method:
;; < SPOILER > ;;
(defun e ( x a b )
(applyfootostring (strcase x t)
'(lambda ( x ) (applyfootochar x (lambda ( x ) (+ b (* a x)))))
)
)
(defun d ( x a b )
(setq a (invert a 26))
(applyfootostring (strcase x t)
'(lambda ( x ) (applyfootochar x (lambda ( x ) (* a (- x b)))))
)
)
(defun applyfootostring ( str foo )
(vl-list->string (mapcar foo (vl-string->list str)))
)
(defun applyfootochar ( cha foo )
(if (< 96 cha 123)
(+ 97 (mod26 (foo (- cha 97))))
cha
)
)
(defun mod26 ( x )
(if (< -1 x) (rem x 26) (mod26 (+ x 26)))
)
(defun invert ( a m / foo )
(defun foo ( a b c d / q )
(if (< 0 d)
(progn
(setq q (/ b d))
(foo c d (- a (* q c)) (- b (* q d)))
)
(if (< a 0)
(foo (+ a m) b c d)
a
)
)
)
(foo 0 m 1 a)
)