During the Vietnam War, Air Force Capt. Carlyle “Smitty” Harris was shot down while flying a combat mission in April 1965. The sixth American to be captured in North Vietnam, Harris spent eight years at Hỏa Lò Prison—nicknamed the Hanoi Hilton—while his wife, Louise; two daughters; and a son he had never met waited for him back in the U.S.

In Tap Code: The Epic Survival Tale of a Vietnam POW and the Secret Code That Changed Everything, Harris recounts how an old method of communication helped him survive 2,871 days of torture and isolation. Used by Royal Air Force POWs during World War II, the tap code was not routinely taught during Vietnam War Air Force training. But after being captured, Harris remembered that an instructor had shown it to him.

“The first time I was put in a cell with other POWs, I immediately taught them the tap code,” Harris says. Each letter is communicated by two tapped out numbers. The first number indicates which row to follow from a column lettered A F L Q V, and the second tells the recipient which letter is intended. C is substituted for K, to make the alphabet fit the five-by-five matrix.

“We used it once we were put back in solitary confinement, and morale went up as we gained guidance from whomever was the senior ranking POW and defeated our captors’ efforts to turn us against one another,” Harris says. Fellow Hanoi Hilton prisoner John McCain also used the tap code to communicate news about colleagues, families, and current events, and Louise had the opportunity to meet McCain’s father after a Pentagon briefing for families of POWs. “Smitty had been a POW for two and a half years before John was shot down,” Louise says, “and Admiral McCain’s concern was evident as he took my hand and assured me and each of the others that he would do ‘all in his power’ to bring our men home.”

The book alternates between Harris’s stories of imprisonment and Louise’s testament of faith that her husband would return as she raised their three young children alone. Louise was eight months pregnant with their third child when she was told that her husband was shot down and his squadron did not see a parachute. Despite the devastating news, Louise never mourned Harris, because, she says, “I believed with all my heart that he was alive.”

Confirmation came five months later, when Louise and her three children were living in Tupelo, Miss. “The postmaster called me at home and said, ‘I think I have a letter from your husband in my hand,’ ” Louise says. “I jumped in the car and raced there. I recognized Smitty’s handwriting immediately.” In the eight years that her husband was imprisoned, Louise sent him 100 packages. He received just two of them, but Louise remained devoted and kept a positive attitude for her children.

“I knew in my heart that Smitty was alive, and if he could endure his challenges, I could as well,” Louise says. “A very good friend in Okinawa told me, ‘You will never be tested beyond your power to endure.’ Each time I felt I was at the edge, some special gift was given—a bit of news, a special moment with the children, a letter from him.”

When Harris finally came home from Vietnam, he dedicated himself to reconnecting with his family. Four decades later, his children, now adults, asked their father to put his story on paper. With the help of coauthor Sara W. Berry, Harris did just that.

“I can recall most of the bad times when I was in the hands of my North Vietnamese captors, but I don’t dwell on those times,” Harris says. “The most important benefit for me was a renewed and strengthened faith in God. I knew that I would never be alone under any circumstances in my life.”