<p>A product-sum calculating unit varies the parameters preset in first and second registers (201, 202) so as to instruct a matrix value calculating section (30) to calculate a matrix value for an error-detecting code (CRC) or for an elliptic curve cryptography (ECC). Then the unit changed the matrix value held in a matrix value register (51) so as to perform a product-sum calculation of the matrix value and data preset in a third register. Thus the unit is used commonly both for CRC encoding calculation and ECC encrypting calculation.</p>