; Faster RSA ; Like David Wagner's earlier code. (let* ( (mod-exp (fileVal "mod-exp")) (eea (fileVal "egcd")) (inv (lambda (a p) (mod-exp a (- p 2) p))) (mrg (lambda (p q) (let ((P (* p (inv p q)))(Q (* q (inv q p)))(pq (* p q))) (lambda(a b) (modulo (+ (* b P)(* a Q)) pq)))))) (lambda (p q) (let ((pq (* p q)) (e 17) (mg (mrg p q)) (em (* (- p 1)(- q 1)))) (if (> (gcd e em) 1) "Bad" (let* ((d (modulo (car (eea e em)) em)) (pe (modulo d (- p 1)))(qe (modulo d (- q 1)))) (cons (lambda (p) (mod-exp p e pq)) (lambda (c) (mg (mod-exp (modulo c p) pe p) (mod-exp (modulo c q) qe q)))))))))