In 1600, a woman named Mary Deane was imprisoned for adultery in London’s Bridewell Prison, where she communicated with her lover in a secret code she’d learned from her mother. Unable to break the cipher, the prison authorities arranged for her to be whipped and deported to Scotland.
I’ve confirmed just enough of this to be sure it happened, but I can’t find many more details, including (as I’d hoped) the code. Still, it’s a striking story.