It is possible to improve safety against the power analysis. Provided is a calculation device including: an input unit (101a) which receives an input value; a calculation unit (106) which calculates an output value; and an output unit (101b) which outputs an output value corresponding to the input value in accordance with a value calculated by the calculation unit (106) as follows. Among the row vectors contained in L (L is an integer not smaller than 1) matrixes having M rows and N columns (M and N are integers not smaller than 2) where the sum of the respective numbers of elements contained in the respective rows are identical between the rows, a value equivalent to an inner product of L row vectors corresponding to the input value and the first-column vector of the N rows predetermined for each of the L matrixes is calculated by the calculation unit (106).