I think you are thinking of The Enemy by Desmond Bagley. It’s on a book shelf at home and I’m away so I can’t check. I recall that the murdered industrialist actually uses a train set to encode an algorithm rather than a code. Will have to check when I get back