An apparatus adapted to improve security against side-channel attacks, comprising: a processor configured to execute: a seed value generator configured to generate a seed value; a divider configured to divide the seed value into a plurality of blocks; a first extractor configured to extract a plurality of first parameter values from a first parameter candidate value set including a plurality of first parameter candidate values, each of the plurality of first parameter values respectively corresponding to one of the plurality of divided blocks; a second extractor configured to extract a plurality of second parameter values from a second parameter candidate value set including a plurality of second parameter candidate values generated by using each of the plurality of first parameter candidate values included in the first parameter candidate value set, each of the plurality of second parameter values respectively corresponding to one of the plurality of divided blocks; a third extractor configured to extract a plurality of third parameter values from a third parameter candidate value set including a plurality of third parameter candidate values generated by using each of the plurality of second parameter candidate values included in the second parameter candidate value set, each of the plurality of third parameter values respectively corresponding to one of the plurality of divided blocks, wherein at least one of the plurality of third parameter candidate values included in the third parameter candidate value set are obtained by multiplying at least one of the second parameter candidate values included in the second parameter candidate value set by a secret key; and a calculator configured to generate a first random number based on the plurality of first parameter values, generate a second random number based on the plurality of second parameter values, and generate a third random number based on the plurality of third parameter values, wherein the processor is further configured to encrypt data or generate a digital signature for the data based on either the first random number, the first random number and the second random number or the first random number, the second random number, and the third random number. a processor configured to execute: a seed value generator configured to generate a seed value; a divider configured to divide the seed value into a plurality of blocks; a first extractor configured to extract a plurality of first parameter values from a first parameter candidate value set including a plurality of first parameter candidate values, each of the plurality of first parameter values respectively corresponding to one of the plurality of divided blocks; a second extractor configured to extract a plurality of second parameter values from a second parameter candidate value set including a plurality of second parameter candidate values generated by using each of the plurality of first parameter candidate values included in the first parameter candidate value set, each of the plurality of second parameter values respectively corresponding to one of the plurality of divided blocks; a third extractor configured to extract a plurality of third parameter values from a third parameter candidate value set including a plurality of third parameter candidate values generated by using each of the plurality of second parameter candidate values included in the second parameter candidate value set, each of the plurality of third parameter values respectively corresponding to one of the plurality of divided blocks, wherein at least one of the plurality of third parameter candidate values included in the third parameter candidate value set are obtained by multiplying at least one of the second parameter candidate values included in the second parameter candidate value set by a secret key; and a calculator configured to generate a first random number based on the plurality of first parameter values, generate a second random number based on the plurality of second parameter values, and generate a third random number based on the plurality of third parameter values, wherein the processor is further configured to encrypt data or generate a digital signature for the data based on either the first random number, the first random number and the second random number or the first random number, the second random number, and the third random number.