A Computational Introduction to Number Theory and Algebra by Victor Shoup.
The first and second editions, published by Cambridge University Press are available for download under a Creative Commons license.
From the preface of the second edition:
Number theory and algebra play an increasingly significant role in computing and communications, as evidenced by the striking applications of these subjects to such fields as cryptography and coding theory. My goal in writing this book was to provide an introduction to number theory and algebra, with an emphasis on algorithms and applications, that would be accessible to a broad audience. In particular, I wanted to write a book that would be appropriate for typical students in computer science or mathematics who have some amount of general mathematical experience, but without presuming too much specific mathematical knowledge.
Even though reliance on cryptography and vendors of cryptography is fading, you are likely to encounter people still using cryptography or legacy data “protected” by cryptography.
BTW, this is only one of several books that Cambridge University Press has published and allowed the final text to remain available.
Should you pen something appropriate and hopefully profitable for you and a publisher, Cambridge University Press should be on your short list.
Cambridge University Press is a great press and a good citizen of the academic world.
.
I first saw this in a tweet by Algebra Fact.