# Tap code

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Tap_code
> Markdown URL: https://mediated.wiki/source/Tap_code.md
> Source: https://en.wikipedia.org/wiki/Tap_code
> Source revision: 1319437569
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

Encoding for text messages

Latin alphabet tap code table 1 2 3 4 5 1 A B C/K D E 2 F G H I J 3 L M N O P 4 Q R S T U 5 V W X Y Z

The *tap code*, sometimes called the **knock code**, is a way to encode text messages on a letter-by-letter basis in a very simple way. The message is transmitted using a series of tap sounds, hence its name.[1]

The tap code has been commonly used by prisoners to communicate with each other. The method of communicating is usually by tapping either the metal bars, pipes or the walls inside a cell.

## Design

The tap code is based on a [Polybius square](/source/Polybius_square) using a 5×5 grid of letters representing all the letters of the [Latin alphabet](/source/Latin_alphabet), except for K, which is represented by C.[2]

Each letter is communicated by tapping two numbers, the first designating the row and the second (after a pause) designating the column. For example, to specify the letter "B", one taps once, pauses, and then taps twice. The listener only needs to discriminate the timing of the taps to isolate letters.

To communicate the word "hello", the cipher would be the following (with the pause between each number in a pair being shorter than the pause between letters):

H E L L O 2, 3 1, 5 3, 1 3, 1 3, 4 •• ••• • ••••• ••• • ••• • ••• ••••

The letter "X" is used to break up sentences, and "K" for acknowledgements.

Because of the difficulty and length of time required for specifying a single letter, prisoners often devise abbreviations and acronyms for common items or phrases, such as "GN" for *Good night*, or "GBU" for *God bless you*.[2]

By comparison, despite its messages being shorter, [Morse code](/source/Morse_code) is harder to send by tapping or banging. Its short and long signals can be improvised as taps and thumps, or short and long whistles or scraping sounds, but tap codes are simpler to learn and can be used in a wider variety of situations.[3] The tap system simply requires one to know the alphabet and the short sequence "AFLQV" (the initial letter of each row), without memorising the entire grid. For example, if a person hears four knocks, they can think "A... F... L... Q". If after a pause there are three knocks, they think "Q... R... S" to arrive at the letter S.

## History

Russian alphabet tap code[4] 1 2 3 4 5 6 1 А Б В Г Д Е/Ё 2 Ж З И/Й К Л М 3 Н О П Р С Т 4 У Ф Х Ц Ч Ш 5 Щ Ъ/Ь Ы Э Ю Я

The origins of this encoding go back to the [Polybius square](/source/Polybius_square) of [Ancient Greece](/source/Ancient_Greece). Like the "knock code", a [Cyrillic script](/source/Cyrillic_script) version is said to have been used by [nihilist](/source/Nihilist_movement) prisoners of the [Russian czars](/source/Russian_czars).[5] The knock code is featured in [Arthur Koestler](/source/Arthur_Koestler)'s 1941 work *[Darkness at Noon](/source/Darkness_at_Noon)*.[6] [Kurt Vonnegut](/source/Kurt_Vonnegut)'s 1952 novel *[Player Piano](/source/Player_Piano_(novel))* also includes a conversation between prisoners using a form of tap code. The code used in the novel is more primitive and does not make use of the Polybius square (e.g. "P" consists of sixteen taps in a row).

United States prisoners of war during the [Vietnam War](/source/Vietnam_War) are most known for having used the tap code. It was introduced in June 1965 by four [POWs](/source/Prisoner_of_war) held in the [Hỏa Lò ("Hanoi Hilton") prison](/source/H%E1%BB%8Fa_L%C3%B2_Prison): Captain [Carlyle "Smitty" Harris](https://en.wikipedia.org/w/index.php?title=Carlyle_%22Smitty%22_Harris&action=edit&redlink=1), Lieutenant [Phillip Butler](/source/Phillip_N._Butler), Lieutenant Robert Peel, and Lieutenant Commander Robert Shumaker.[2][7] Harris had heard of the tap code being used by prisoners in World War II[8] and remembered a [United States Air Force](/source/United_States_Air_Force) instructor who had discussed it as well.[2][9]

In Vietnam, the tap code became more widely used than Morse; despite messages taking longer to send, the system was easier to learn and could be applied in a wider variety of situations.[3] Tap codes proved to be a very successful[10] way for otherwise isolated prisoners to communicate.[8][11] POWs would use the tap code in order to communicate to each other between cells in a way which the guards would be unable to pick up on.[12] They used it to communicate everything from what questions interrogators were asking (in order for everyone to stay consistent with a deceptive story), to who was hurt and needed others to donate meager food rations. It was easy to teach and newly arrived prisoners became fluent in it within a few days.[13][14] It was even used when prisoners were sitting next to each other but not allowed to talk, by tapping on another's thigh.[14] U.S. Navy Rear Admiral [Jeremiah Denton](/source/Jeremiah_Denton) developed a vocal tap code of coughs, sniffs and sneezes.[3] By overcoming isolation with the tap code, prisoners were said to be able to maintain a [chain of command](/source/Chain_of_command) and keep up morale.[8][15]

In 1980, a doctor sentenced to life in solitary confinement in [Somalia](/source/Somalia) used tap code to share the entirety of Tolstoy's *[Anna Karenina](/source/Anna_Karenina)*, nearly 2 million letters, via tap code with fellow prisoners.[16]

## In popular culture

In the 1990 video game *[Metal Gear 2: Solid Snake](/source/Metal_Gear_2%3A_Solid_Snake)*, the tap code is used by Dr. Drago Pettrovich Madnar to communicate to *[Solid Snake](/source/Solid_Snake)* through a cell wall.

In Season 2 Episode 2 of *[Person of Interest](/source/Person_of_Interest_(TV_series))* in 2012, the tap code is used by Harold Finch to discreetly leave breadcrumbs of his location to John Reese by encoding his location as tap code on a telephone.

In the 2015 video game *[Her Story](/source/Her_Story_(video_game))*, the main characters use the tap code to surreptitiously communicate.

In Season 2 Episode 14 of *[The Flash](/source/The_Flash_(2014_TV_series))* in 2016, the masked prisoner in Zoom's lair uses the tap code to try to communicate with the others.

In the 2021 film *[The Ice Road](/source/The_Ice_Road)*, the tap code is used on a metal pipe conduit by trapped miners to communicate with executives of the mining company.

## See also

- [Morse code](/source/Morse_code)

## References

1. **[^](#cite_ref-1)** The Handbook Of The SAS And Elite Forces. How The Professionals Fight And Win. Edited by Jon E. Lewis. p.199-Tactics And Techniques, Evasion, Capture And Escape. Robinson Publishing Ltd 1997. ISBN 1-85487-675-9

1. ^ [***a***](#cite_ref-pbs_2-0) [***b***](#cite_ref-pbs_2-1) [***c***](#cite_ref-pbs_2-2) [***d***](#cite_ref-pbs_2-3) ["'Return with Honor': The Tap Code"](https://www.pbs.org/wgbh/americanexperience/features/honor-tap-code/). *[American Experience](/source/American_Experience)*. [PBS](/source/Public_Broadcasting_Service). 1999. [Archived](https://web.archive.org/web/20121110134840/https://www.pbs.org/wgbh/amex/honor/sfeature/sf_tap.html) from the original on 2012-11-10. Retrieved 2008-04-08.

1. ^ [***a***](#cite_ref-denton_3-0) [***b***](#cite_ref-denton_3-1) [***c***](#cite_ref-denton_3-2) Denton, Jeremiah A.; Brandt, Ed (1976). *[When Hell Was in Session](/source/When_Hell_Was_in_Session)*. New York: Reader's Digest Press. [ISBN](/source/ISBN_(identifier)) [0-88349-112-5](https://en.wikipedia.org/wiki/Special:BookSources/0-88349-112-5).

1. **[^](#cite_ref-4)** ["Far Outliers: Russian Prison Tapping Code"](http://faroutliers.blogspot.com/2005/04/russian-prison-tapping-code.html). April 14, 2005. [Archived](https://web.archive.org/web/20140815063344/http://faroutliers.blogspot.com/2005/04/russian-prison-tapping-code.html) from the original on August 15, 2014. Retrieved August 8, 2014.

1. **[^](#cite_ref-5)** [David Kahn](/source/David_Kahn_(writer)), *The Codebreakers – The Story of Secret Writing*. 1967. [ISBN](/source/ISBN_(identifier)) [978-0-684-83130-5](https://en.wikipedia.org/wiki/Special:BookSources/978-0-684-83130-5).

1. **[^](#cite_ref-6)** Koestler, Arthur, *Darkness at Noon* (1941). Translated by Daphne Hardy. See page 19 of the Bantam Publishing paperback, 1981 printing for more info.

1. **[^](#cite_ref-7)** Borling, John (2013). *Taps on the Walls: Poems from the Hanoi Hilton*. Priztker Military Library: Master Wings Publishing. pp. 1–9. [ISBN](/source/ISBN_(identifier)) [978-0-615-65905-3](https://en.wikipedia.org/wiki/Special:BookSources/978-0-615-65905-3).

1. ^ [***a***](#cite_ref-au_8-0) [***b***](#cite_ref-au_8-1) [***c***](#cite_ref-au_8-2) Staff Sgt. Jason Tudor (1998-03-18). ["Vets, Flyers discuss ideology, time in POW camps"](https://web.archive.org/web/20071203095911/http://www.au.af.mil/au/awc/awcgate/awc-pow.htm). [Air Force News Service](/source/Air_Force_News_Service). Archived from [the original](http://www.au.af.mil/au/awc/awcgate/awc-pow.htm) on 2007-12-03. Retrieved 2008-04-08.

1. **[^](#cite_ref-9)** Townley, Alvin. (4 February 2014). *Defiant : the POWs who endured Vietnam's most infamous prison, the women who fought for them, and the one who never returned* (First edition : February 2014 ed.). New York. [ISBN](/source/ISBN_(identifier)) [9781250006530](https://en.wikipedia.org/wiki/Special:BookSources/9781250006530). [OCLC](/source/OCLC_(identifier)) [862575088](https://search.worldcat.org/oclc/862575088).{{[cite book](https://en.wikipedia.org/wiki/Template:Cite_book)}}: CS1 maint: location missing publisher ([link](https://en.wikipedia.org/wiki/Category:CS1_maint:_location_missing_publisher))

1. **[^](#cite_ref-10)** Peterson, Gordon I; Taylor, David C (March 2016). ["Intelligence Support to Communications with US POW's in Vietnam"](https://web.archive.org/web/20190508044337/https://www.cia.gov/library/center-for-the-study-of-intelligence). *Studies in Intelligence*. **60**. Center for the Study of Intelligence Publications: 1–15. Archived from [the original](https://www.cia.gov/library/center-for-the-study-of-intelligence) on 2019-05-08. Retrieved 2019-05-23.

1. **[^](#cite_ref-11)** Fretwell, Peter; Kiland, Taylor Baldwin (2013). *Lessons from the Hanoi Hilton: Six Characteristics of High Performance Teams*. Annapolis, Maryland: Naval Institute Press. pp. 63–67. [ISBN](/source/ISBN_(identifier)) [978-1-61251-217-4](https://en.wikipedia.org/wiki/Special:BookSources/978-1-61251-217-4).

1. **[^](#cite_ref-12)** Hirsch, James S (2004). [*Two Souls Indivisible: The Friendship that saved two POW's in Vietnam*](https://archive.org/details/twosoulsindivisi00hirs/page/161). New York: Houghton-Mifflin. pp. [161-162](https://archive.org/details/twosoulsindivisi00hirs/page/161). [ISBN](/source/ISBN_(identifier)) [0618273484](https://en.wikipedia.org/wiki/Special:BookSources/0618273484).

1. **[^](#cite_ref-13)** [McCain, John](/source/John_McCain); [Mark Salter](/source/Mark_Salter) (1999). [*Faith of My Fathers*](/source/Faith_of_My_Fathers). [Random House](/source/Random_House). pp. [211](https://archive.org/details/faithofmyfathersmcc00mcca/page/211)–12. [ISBN](/source/ISBN_(identifier)) [0-375-50191-6](https://en.wikipedia.org/wiki/Special:BookSources/0-375-50191-6).

1. ^ [***a***](#cite_ref-brace_14-0) [***b***](#cite_ref-brace_14-1) [Brace, Ernest C.](/source/Ernest_C._Brace) (1988). *A Code to Keep: The true story of America's longest held civilian prisoner of war in Vietnam*. [St. Martin's Press](/source/St._Martin's_Press). pp. 171–72, 187–88. [ISBN](/source/ISBN_(identifier)) [0-7090-3560-8](https://en.wikipedia.org/wiki/Special:BookSources/0-7090-3560-8).

1. **[^](#cite_ref-15)** Naughton, Robert J (1975). ["Motivational Factors of American Prisoners of War Held by the Democratic Republic of Vietnam"](https://digital-commons.usnwc.edu/nwc-review/vol28/iss1/2). *Naval War College Review*. **28**. [Archived](https://web.archive.org/web/20190504141451/https://digital-commons.usnwc.edu/nwc-review/vol28/iss1/2/) from the original on 2019-05-04. Retrieved 2019-05-04.

1. **[^](#cite_ref-16)** ["Rough Translation: How 'Anna Karenina' Saved A Somali Inmate's Life"](https://www.npr.org/2017/09/11/550058353/rough-translation-how-anna-karenina-saved-a-somali-inmates-life). *[NPR](/source/NPR)*. 2017-09-11. [Archived](https://web.archive.org/web/20230626065411/https://www.npr.org/2017/09/11/550058353/rough-translation-how-anna-karenina-saved-a-somali-inmates-life) from the original on 2023-06-26.

## External links

- [Online Tap Code Encoder/Decoder](http://www.braingle.com/brainteasers/codes/tapcode.php)

- [Russian Prison Tap Codes](http://faroutliers.blogspot.com/2005/04/russian-prison-tapping-code.html)

- [L' Alfabeto Quadrato(Codice a Colpi) - An Degrida](http://www.premioceleste.it/opera/ido:260668/) Artist An Degrida's Tap Code artistic illustration.

v t e Classical cryptography Ciphers by family Polyalphabetic Alberti Beaufort Enigma Trithemius Vigenère Polybius square ADFGVX Bifid Nihilist Tap code Trifid VIC cipher Square Playfair Two-square Four-square Substitution Affine Atbash Autokey Caesar Chaocipher Great Hill Pigpen ROT13 Running key Transposition Columnar Double Myszkowski Rail fence Route Other BATCO DRYAD Kama Sutra One-time pad Rasterschlüssel 44 Reihenschieber Reservehandverfahren Slidex Solitaire Codes Book Code talker Poem Steganography Bacon Grille Null Cryptanalysis Cryptogram Frequency analysis Index of coincidence (Units: Ban and Nat) Information leakage Kasiski examination v t e Cryptography General History of cryptography Outline of cryptography Classical cipher Cryptographic protocol Authentication protocol Cryptographic primitive Cryptanalysis Cryptocurrency Cryptosystem Cryptographic nonce Cryptovirology Hash function Cryptographic hash function Key derivation function Secure Hash Algorithms Digital signature Kleptography Key (cryptography) Key exchange Key generator Key schedule Key stretching Keygen Machines Ransomware Random number generation Cryptographically secure pseudorandom number generator (CSPRNG) Pseudorandom noise (PRN) Secure channel Insecure channel Subliminal channel Encryption Decryption End-to-end encryption Harvest now, decrypt later Information-theoretic security Plaintext Codetext Ciphertext Shared secret Trapdoor function Trusted timestamping Key-based routing Onion routing Garlic routing Kademlia Mix network Mathematics Cryptographic hash function Block cipher Stream cipher Symmetric-key algorithm Authenticated encryption Public-key cryptography Quantum key distribution Quantum cryptography Post-quantum cryptography Message authentication code Random numbers Steganography Category

---
Adapted from the Wikipedia article [Tap code](https://en.wikipedia.org/wiki/Tap_code) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Tap_code?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
