A method for correcting a data error in data having 2 n data bits where n>2, the method comprising: setting, for each data bit, n-bit binary index numbers corresponding to the decimal index numbers 0,..., 2 n-1 of the data bits; obtaining n first check code generation expressions according to the binary index numbers, and generating a first check code according to the n first check code generation expressions; and obtaining n second check code generation expressions according to the binary index numbers, and generating the second check code according to the n second check code generation expressions; and comparing the first check code with the second check code to determine an erroneous data bit, and correcting the erroneous data bit: characterized in that the step of obtaining the n first check code generation expressions according to the n-bit binary index numbers and generating the n first check code according to the n first check code generation expressions comprises: performing, for each bit of the n binary index number bits, an exclusive-or operation only on data bits of the data for which corresponding bits of respective binary index numbers is 1, or performing, for each bit of the n binary index number bits, an exclusive-or operation only on data bits of the data for which corresponding bits of respective binary index numbers is 0, in order to obtain one of the n first check code generation expressions; and determining a result of each of the n first check code generation expressions and taking the result as a corresponding bit of the first check code; and in that the method further comprises the step of: generating a total check code by performing an exclusive-or operation on all the data bits of the data. setting, for each data bit, n-bit binary index numbers corresponding to the decimal index numbers 0,..., 2 n-1 of the data bits; obtaining n first check code generation expressions according to the binary index numbers, and generating a first check code according to the n first check code generation expressions; and obtaining n second check code generation expressions according to the binary index numbers, and generating the second check code according to the n second check code generation expressions; and comparing the first check code with the second check code to determine an erroneous data bit, and correcting the erroneous data bit: characterized in that the step of obtaining the n first check code generation expressions according to the n-bit binary index numbers and generating the n first check code according to the n first check code generation expressions comprises: performing, for each bit of the n binary index number bits, an exclusive-or operation only on data bits of the data for which corresponding bits of respective binary index numbers is 1, or performing, for each bit of the n binary index number bits, an exclusive-or operation only on data bits of the data for which corresponding bits of respective binary index numbers is 0, in order to obtain one of the n first check code generation expressions; and determining a result of each of the n first check code generation expressions and taking the result as a corresponding bit of the first check code; and in that the method further comprises the step of: generating a total check code by performing an exclusive-or operation on all the data bits of the data. characterized in that the step of obtaining the n first check code generation expressions according to the n-bit binary index numbers and generating the n first check code according to the n first check code generation expressions comprises: performing, for each bit of the n binary index number bits, an exclusive-or operation only on data bits of the data for which corresponding bits of respective binary index numbers is 1, or performing, for each bit of the n binary index number bits, an exclusive-or operation only on data bits of the data for which corresponding bits of respective binary index numbers is 0, in order to obtain one of the n first check code generation expressions; and determining a result of each of the n first check code generation expressions and taking the result as a corresponding bit of the first check code; performing, for each bit of the n binary index number bits, an exclusive-or operation only on data bits of the data for which corresponding bits of respective binary index numbers is 1, or performing, for each bit of the n binary index number bits, an exclusive-or operation only on data bits of the data for which corresponding bits of respective binary index numbers is 0, in order to obtain one of the n first check code generation expressions; and determining a result of each of the n first check code generation expressions and taking the result as a corresponding bit of the first check code; and in that the method further comprises the step of: generating a total check code by performing an exclusive-or operation on all the data bits of the data.