A method of producing a two-dimensional code having a code area in which a plurality of data blocks each consisting of a plurality of cells are mapped, the cells including cells for a first type of data codes to be coded as codewords and allowed to be disclosed publicly, comprising the step of: adding an end identification code (S121') at an end of a code string composed of the first type of data codes, the end identification code showing the end of the code string, characterized by the steps of determining whether or not it is required to map second type of data codes in the code area, the second type of data codes being coded as the codewords so as to having contents which should be kept in secret to unauthorized persons if the second type of data codes are decoded; arranging a secret identification code so as to immediately follow the end identification code if it is determined by the determining step such that it is required to map the second types of data codes, the secret identification code showing that the data codes arranged successively from the secret identification code are the second type of data codes; arranging the second type of data codes so as to immediately follow the secret identification code; arranging filler codes (S132, S135) after the second type of data codes such that the code area is filled up with the filler codes if a total amount of the codewords mapped in the code area is less than an amount of codewords allowed to be mapped maximally in the code area; and producing the first type of data codes, the end identification code, the secret identification code, the second type of data codes, and the filler codes, into the cells mapped in the code blocks in the code area of the two-dimensional code. adding an end identification code (S121') at an end of a code string composed of the first type of data codes, the end identification code showing the end of the code string, characterized by the steps of determining whether or not it is required to map second type of data codes in the code area, the second type of data codes being coded as the codewords so as to having contents which should be kept in secret to unauthorized persons if the second type of data codes are decoded; arranging a secret identification code so as to immediately follow the end identification code if it is determined by the determining step such that it is required to map the second types of data codes, the secret identification code showing that the data codes arranged successively from the secret identification code are the second type of data codes; arranging the second type of data codes so as to immediately follow the secret identification code; arranging filler codes (S132, S135) after the second type of data codes such that the code area is filled up with the filler codes if a total amount of the codewords mapped in the code area is less than an amount of codewords allowed to be mapped maximally in the code area; and producing the first type of data codes, the end identification code, the secret identification code, the second type of data codes, and the filler codes, into the cells mapped in the code blocks in the code area of the two-dimensional code.