# Encryption/ciphers/codes in Chinese

I am quite curious as to how you can perform simple encryption for the Chinese language.

Saw a similar question related to encryption/Chinese here: About cryptography in a character language, however the method of encryption appears to be quite complicated.

If I'm not mistaken, the method described in the answer above, requires something similar to a table which pre-maps certain characters to other characters; or the use of something like an One-time pad - both of which requires a fair amount of prior communication between both parties.

I was wondering if there is something simpler, what I have in mind is something like a Substitution cipher. That is, a way to encode the message easily, and also allowing the message to be decoded easily (if the secret key is known) or cracked given analysis or use of decoding techniques/knowledge.

For example, in English there are many ways to encrypt a message - some common/simple examples ROT13, Vigenere.

However, I can't seem to see how the concept of "pulling apart" a word can apply to Chinese characters.

For example, I can (fairly easily) encode the below using Vignere (key: chocolate), but how would I do so in Chinese?

I am learning Chinese --> K ha nslrgmpn Qjwyeli

-

## migrated from chinese.stackexchange.comJan 31 '12 at 15:38

This question came from our site for students, teachers, and linguists wanting to discuss the finer points of the Chinese language.

I take your question to mean, how both historically and in the modern age one could construct a pen-and-paper cipher using the Chinese language.

As pointed out in the question, Chinese is a logographic langauge and therefore has a far greater number of characters than Phonetic systems. Historically this has cause chinese codes not to be based around the script.

The following claims are taken from a forum discussion and translation of ancient chinese codes for lack of a better source.

• Nüshu script may not have been intended for secrecy but it functions as such since it was almost exclusively used and readable by educated Chinese women. It was phonetic and had a set of 700 characters. This suggests that one could use the phonetic attributes of the chinese language as a basis for a reduced character set on top of which one could implement a code.

• In an earlier form of secret sharing, messages were cut into strips and delivered by different couriers.

The so called “阴书” was to write the document vertically and cut it into 3 sections. Sent 3 persons, and each person would hold one of the sections. They would depart in different times and using different paths. When the receiver received all 3 parts, he could get the whole thing of this secret document. If one of the messengers was captured by the enemies, the enemy would have difficulties to understand the secret document. As translated by the Chinese History Forum

• The technique of phrases is something I don't entirely understand I think the method is essentially to use the phonetic sound from ciphertext logographic characters to transmit a secret message. In english "eyesight hat very eight seashore create rat table" or "I ha-ve a se-cre-re-t"

“反切” (fan3 qie4) is a kind of phonetic system originated in ancient time to help document the pronunciation of Chinese language. The basic method for (fan3 qie4) is: Take the first word 上字 (shang4 zi4 - upper word) for its starting sound (or the consonant) and the second word (xia4 zi – lower word) for its ending sound (or the vowel). The tone would follow the ending sound. Therefore, a word is separated into two parts: 声母 (sheng mu3 – starting sound), 韵母 (yun4 mu3 – ending sound). Use the 声母 sheng mu adding a 韵母yun mu from another word to form the “反切” fan qie’s first word (or upper word). Use the 声母 sheng mu from another word adding a 韵母yun mu from this word to form the “反切” fan qie’s second word (or lower word). Use the lower word’s tone for the word’s tone. The first word’s starting sound and the second word’s ending sound is the pronunciation of the original word. As translated by the Chinese History Forum

• Code sticks were used in which each stick length represented a particular pre-agreed upon message. These stick lengths could be transmitted using signal fires without actually having to physically send the stick. More generally this technique is equivalent to code books which were also used by the ancient Chinese.

For example, one inch stick means victory. 9 inches stick means the army has broken the enemy army and captured the enemy generals. 8 inches stick means the enemy’s city (cities) has surrendered. 7 inches stick means successfully resisted the enemy’s army and the enemy’s army was gone. 6 inches stick means the army should be alert and defend the place diligently. As translated by the Chinese History Forum

• Grille ciphers have often been remarked as excellent pen and paper ciphers for chinese.

• While I can't find any historical reference to it, transposition ciphers seem completely compatible with the chinese language. Although one would have to choose the words carefully because some meaning would leak out as whole words are transposed rather than letters.

• A method of enciphering chinese characters similar to rot16 would be to write different characters on top of each other in different colors of ink. The key would state which color at each position was the correct character. For instance the key could be 'blue-red-red-black-green-blue'. One of the interesting features of such a scheme is that one could design the cipher text such that all possible keys encode an apparently valid and readable message. One advantage of this scheme would also be that it is secure against colorblind adversaries.

-

If you save the current page and examine the file with an hex editor, you will likely find that your example Chinese string is represented by the bytes

E6 88 91 E5 9C A8 E5 AD B8 E4 B8 AD E6 96 87

One option, very suitable for implementation by a machine, is to encipher the bytes representing the message in this (or other) format used by the machine. This will work well for a modern strong cipher, but quite poorly for a weak cipher like Vigenere. And it is very inappropriate for a hand cipher.

-

It seems I can't comment on answers because the question is no longer on the Chinese Q&A, but I wanted to support fgrieu's suggestion. Certain web services don't have much care for security, but they want to avoid containing keywords that are blocked by the Chinese Firewall. One I'm familiar with is PIMCloud, a cloud-supported IME, which does exactly what fgrieu suggested - reduces characters to the hexadecimal version of their unicode codepoint then performs a rot13-like substitution on these.

Obviously this is pretty difficult to do without a computer, but not impossible if you have a table of unicode codepoints (I know you rejected the 'great big substitution table' idea, but this was on the basis of requiring lots of communication rather than using something which is pretty easy for both sides to get hold of)

To use your example, 我在學中文 would first be changed to E68891E59CA8E5ADB8E4B8ADE69687.

Then this would be encrypted to 6E00196D14206D25306C30256E1E0F using a hexadecimal version of rot13 (rot8?)

To decode it, rot8 again to get back to E68891E59CA8E5ADB8E4B8ADE69687, then convert back to unicode*. A Vigenere cypher would also be possible, as long as the keyword was also hexadecimal, e.g. E5B7A7E5858BE58A9B instead of chocolate.

* by 'unicode' I mean UTF8.

-
Chinese computer users use standard keyboards. They construct the characters by typing latin letters (this system is called en.wikipedia.org/wiki/Hanyu_pinyin ), this process is reversible. (1). Write the chinese sentience in latin-alphabet using the Hanyu-Pinyin system, (2). apply rot13/vigenere, (3). type the result. It should be similar to your system but easier for users since it doesn't require doing UTF8 table look ups. –  Ethan Heilman Feb 1 '12 at 14:41
That wouldn't work very well - pinyin isn't actually reversible as multiple characters share the same pinyin - for example, 十 (ten) is pronounced the same way as 石 (stone). If you ignore the tones, it's even worse. In most cases it's possible to figure out that the wrong character has been used, but it's not lossless. –  Ironfrost Feb 6 '12 at 2:46
+1 Very interesting/good catch. I had just assumed that such a mapping would be reversible. I know this defeats the purpose of the exercise but what about translating a word into a phonetic alphabet (say english) and then using rot13. As a teenager me and some of my friends used online translation engines such as babel-fish as a form of code. –  Ethan Heilman Feb 6 '12 at 5:02
Yeah, unfortunately pinyin isn't a 1-1 mapping. Plus, in some Chinese speaking countries they don't learn pinyin, they learn zhuyin (en.wikipedia.org/wiki/Zhuyin). But same problem as pinyin - it isn't a 1-1 mapping. –  pyko Feb 6 '12 at 22:46