In methods for determining, in a way that is protected against spying, the
modular inverse b of a value a in relation to a module n for a
cryptographic application, an auxiliary value .beta. and an auxiliary
module .delta. are determined at least depending on the value a, the
module n and at least one masking parameter r, an auxiliary inverse
.beta.' is determined as the modular inverse of the auxiliary value
.beta. in relation to the auxiliary module .delta., and the modular
inverse b is determined at least depending on the auxiliary inverse
.beta.', the at least one masking parameter r, and the auxiliary value
.beta. and/or the auxiliary module .delta.. A computer program product
and a portable data carrier have corresponding features. The invention
provides a method for modular inversion, secured against spying, which is
suitable for applications where security is critical, such as, e.g.
cryptographic calculations on a portable data carrier.