Comment by jcalvinowens
2 days ago
I use this as a teaching aid: https://github.com/jcalvinowens/toy-rsa
It's an ugly naive implementation, but it's much simpler and more accessible than any real one I've ever seen, and depends on nothing but libc.
Depending on what you're trying to teach, I would think something like these would be nicer to read (but with minimal dependencies): https://github.com/jackkolb/TinyRSA or https://github.com/i404788/tiny-rsa
The point for me is a naive BIGNUM library that somebody who has only had high school level math can easily understand.