In military terminology, a countersign is a sign, word, or any other signal previously agreed upon and required to be exchanged between a or guard and anybody approaching his or her post. The term usually encompasses both the sign given by the approaching party as well as the sentry's reply. However, in some armies, the countersign is strictly the reply of the sentry to the password given by the person approaching. A well-known sign/countersign used by the Allied forces on D-Day during World War II: the challenge/sign was "flash", the password "thunder", and the countersign "Welcome".
Obfuscation
The signs are often worked into a sentence in some way, nominally to obfuscate which words are key in case there are spies nearby. An example would be the sign "blue" and the countersign "moon". The approacher might say, "I'm feeling blue today... got any ideas of how I could cheer up?" The sentry could reply with, "Well, you could always moon somebody." Although in this example the code could be easily deduced, the inclusion of more words the same type as the codeword confuses the issue significantly. Under normal circumstances a sign and countersign are for establishing immediate security only with further identification, via documents or interrogation, needed once in a more secure or private location. Signs and counter signs are most commonly found when two forces find each other and need verification that it is another friendly force.
A similar technique is becoming common in computer networking, particularly for bankingweb sites. For example,, a user might enter his or her user-ID, but withhold the corresponding password until the server replied to the user-ID with a previously agreed-upon phrase and/or image. So long as the connection is secure, and the user can choose from a wide range of phrases and/or images in the set-up process, they can be confident that they are signing on to the legitimate site, rather than to a spoofed one.
In literature
The opening lines of William Shakespeare's play Hamlet are between soldiers on duty are viewed as representing a crude sign, where the line "Long live the King!" was a sign between soldiers: