A method for generating a two-dimensional barcode, including: obtaining a protection-encoding pattern based on a mask pattern reference, the mask pattern reference being a reference for identifying a mask pattern that is applied to a module group, the module group being composed of a plurality of modules, each module being a unit cell constituting the two-dimensional barcode; obtaining a protection-encoded code block by protection-encoding a code block with the protection-encoding pattern, the code block having at least a data codeword; generating the module group based on the protection-encoded code block; and generating the two-dimensional barcode having the module group to which the mask pattern is applied.
展开▼