As I am working on a spy novel, the subject of encoding will definitely come up in regards to information transfer. Problem is, I don't know a thing about it. Can someone help me find a site or a codebook I might be able to learn from?
My #1 advice is to avoid the Hollywood cliché of brilliant hackers or cryptanalysts who can break any code when given enough time. Focus not on the technical aspect, but on the human element of security: eavesdropping, tricking people into giving up passwords, exploiting security questions with known answers (e.g. "where were you born"), etc. That is not just to spare the readers from technical details. It is how real life works.
This story takes place in the 1870s. No fancy computers, just pen and paper. Maybe morse code, but is is possible to encrypt that?
Short of using a one-time pad, this is probably one of the most secure encryption schemes you could have used in that era: https://www.schneier.com/solitaire.html All it needs is time and a pack of cards, and it's considered fairly secure even against modern computers.
Cryptography is only one aspect of the case. If the secret police finds out that your protagonist sends encrypted messages to someone they will get suspicious. The solution to this problem is called "steganography". It is basically a secret message enclosed in a normal message. The most basic form is when you have a sheet of paper with holes on it, put that sheet on the mail and read the letters visible via the holes. Without the "key sheet" the letter is just a normal message. Usually the hidden message is also encrypted in some way. I suggest to use the OTP (One Time Pad) method as that is an unbreakable encryption. Most of the hacking today is "social engineering" which is basically an attack against the weakest point of the protection : the human. If the information is encrypted but the decryption key/password is written on paper and laying on the desk then it is much easier to get the paper than breaking the encryption.