Gong Xua Yang Ming

Gong Xua Yang Ming is one of the identifications required to be used by fictional characters before they can be dressed as a character from The Littl' Bits. It is used by characters living in the USA, Japan, Romania, Russia, Germany, Liftland and Wendystan.

Composition
The composition is AAABBBCMDYYYGNNNLLLHHZZZZZZZZZZX, where AAA indicates the first name, BBB indicates the surname, CMDYYY indicates the century, month, date and year of first appearance, G indicates gender, NNN are random numbers, LLL are random letters, HHZZZZZZZZZZ indicate the character's hometown (a two-letter state/country code followed by the postal code) and X is a checksum consonant.

First name (3 letters)


 * The first three letters indicate the first three consonants of the first name. If there is more than one name, both are considered as if they were one. If the name has less than three consonants, then vowels will replace the blank spaces, in the same order they appear in the name (e.g. "Marco" would be MRC, "Paola" would be PLA). If the whole name has less than three letters, the blank spaces are filled with an X (e.g. Chinese name "Na" would be NAX). If the name has more than three consonants, the 2nd is skipped (e.g. "Riccardo" would be RCR; "Martina" would be MTN). This second-consonant skipping rule for names that have more than three consonants is only used for first names, not for surnames.

Surname (3 letters)


 * The first three consonants of the surname are used. If there is more than one surname, both are considered as if they were one. If the surname has less than three consonants, then vowels will replace the blank spaces, in the same order they appear in the surname (e.g. "Rossi" would be RSS, "Masi" would be MSA). If the whole surname has less than three letters, the blank spaces are replaced with an X (e.g. "Fo" would be FOX, "Hu" would be HUX).

Date, month, year and century of first appearance (7 alphanumeric characters)
 * Century of first appearance (one letter): all the letters of the English alphabet are used to indicate century (A = 1st century, Z = 26th century). Most often Q, R, S or T.
 * Month of first appearance (one letter): each single month is associated with one letter, as shown in the table:


 * Date of first appearance (one alphanumeric character): each date is associated with either letter or number, as shown in the table:


 * Year of first appearance (three alphanumeric characters): Year of first appearance in vigesimal number, using 0 to 9 and A to H, J and K (I is unused). For example, a character first appeared in 1934 will be 4GE, 1973 would be 4JD, 1929 would be 4G9, 1870 would be 4DA, 1901 would be 4F1, 1865 would be 4D5 and 1940 would be 4H0.

Gender (one letter)
 * The next letter indicates the gender: M for males and F for females.

Random (six alphanumeric characters)
 * The first three alphanumeric characters in random section are random numbers, and the last three are random letters.

Hometown (twelve alphanumeric characters)
 * The next twelve indicate the hometown, where the first two are letters which indicate the state or country (for example, if the character lives in the US, then the first two are the abbreviation of the character's hometwon state, or, if the character lives in Japan as the hometown, the first two are 'JP'). The remaining are the postal code.

Checksum (one letter)
 * The final letter is a checksum consonant. Starting from the preceding 15 characters, a check digit is determined as follows:
 * the eight odd characters (1st, 3rd, 5th, etc.) are set apart; same thing for the seven even ones (2nd, 4th, 6th, etc.).
 * after that, each single character is converted into a numeric value as show in the tables below:


 * after that, all of the values are to be added up, and the final result has to be divided by 21; the remainder (Modulo) will give the last consonant, according to the following table:

Examples
Here is an example of GXYM of Princess Elena Castillo Flores:
 * First name: ELN
 * Surname: FLR
 * Century of first appearance: R
 * Month of first appearance: L
 * Day of first appearance: A
 * Year of first appearance: 4EC
 * Gender: F
 * Random numbers: 452
 * Random letters: GJO
 * Hometown state: LL
 * Hometown postal code: 0000746153
 * Checksum consonant: M
 * Full order: ELN FLR RLA4EC F425GJO LL0000746153M