It was a fairly common practice in Pepys' day to use characters that were not part of the standard alphabet in one's ciphers. In addition to a simple substitution scheme (where, for instance, a=l, b=m, c=n, etc.), other original, i.e., non-alphabetical, symbols might be used to replace common words such as 'and', 'the', 'with' etc. There would probably also be nulls (symbols that stood for nothing at all, designed to confuse the enemy cryptologist) and possibly also a dowbleth (a symbol indicating that the next character should be read as a double letter).

I hope for Pepys' sake that his cipher was a good one, although I doubt it was as cleverly nasty as the Great Cipher used by Louis XIV's spymasters, Antoine and Bonaventure Rossignol (father and son), which after their deaths (they had not passed its secrets on to anyone else) was not broken until the 1890s. (For more fascinating information about the history cryptography, I recommend "The Code Book: the Evolution of Secrecy from Mary Queen of Scots to Quantum Cryptography", by Simon Singh.)

‘After dinner, home.… ‘And how much it is like his life moving about the streets of London and Westminster, meeting and eating and drinking--and then home. It took me aback that he could do this from ship to ship with such ease.

... out of the norm considering how often he'd been rowed from place to place on the Thames. And the amount his current destinations roll with the waves could be likened to a few stiff drinks at the inn.

How would a character be deciphered? If Sam was making up a code on the spot - a different code, presumably, for each character he created - would the recipient have to crack the code? What if they couldn't do it? And if it was a simple code to decipher, couldn't anyone who intercepted the letter do the same?

If this wasn't the case, how would it work? I can't imagine there was a code book or a key somewhere...?

I'm guessing, of course, but I would imagine Montagu would use the same code, with the key distibuted to a small number of confidantes. Either that, or a personal code agreed with each contact.

It seems unlikely that Sam is making up a new code each time he sends a letter, as this would surely take too long, although theoretically it would be possible to make subtle changes to previously used ciphers using nulls and dowbleths to create a new cipher.

If the key wasn't already held by the recipient, perhaps it was sent under separate cover?

Encode/Decode: Maybe a book, that both do have? or even the King James Bible ? The place in the book (page, chapter or paragraph, offsets by date) to give the offset code letter? or inbedded in the the name of sender or receiver? maybe an ex. sigs type may remember the history of secret codes of the times. It must be off the secret list by now in the age of disclosure, no longer "in patent" or maybe it is still a monopoly of the powers to be:

It was probably, technically speaking, not a code but a cipher. Probably a simple substitution cipher, examples of which can be seen in many newspapers (mine calls it the "Cryptoquote"). These are broken by freqency analysis, as it's hard to conceal that some letters are used far more often than others. ("In this message, Z appears more often than any other letter. If this message is written in English, it probably is 'E'...")

Codes can be harder to break, but also require a more elaborate setup (making sure all the users have the codebook, which might be large or hard to hide), and may be less flexible. (For instance, what if you want to send a message that includes terms not in your codebook?)

The simple substitution ciphers of Pepys' day were vulnerable to frequency analysis. Codes would have been vulnerable to theft of the codebook. Both would have potentially been vulnerable to too much usage of the same code or cipher, which is probably why Pepys periodically has the job of coming up with new schemes.

it would make it easier to guess at the kind of code or cypher being used. If it is for Monck, for example, it would be reasonable to guess that he and Mountagu have a particular character agreed between them and reserved to them.

"All the afternoon finishing of the character, which I did and gave it my Lord, it being very handsomely done and a very good one in itself, but that not truly "Alphabetical" "Very time consuming and has a few extra twists in it to fool the spies.