Method for securely encrypting or decrypting a message or for generating or verifying a digital signature of a message, wherein a mathematical operation is applied to the message with the aid of a processor using a key k, which can be represented as a binary number with a sequence of bits b i, comprising the steps: - Initializing a first auxiliary variable z0 and a second auxiliary variable z1; - Determining a memory address respectively for the first z0 and second auxiliary variable z1 and assigning the first memory address to an address variable r; - Calculating a differential value d from the difference between the memory addresses; - Implementing the following steps sequentially for each bit b i starting from the most significant bit MSB: (a) Updating the first auxiliary variable z0 by applying a first computation operation to the first auxiliary variable z0; (b) Updating the second auxiliary variable z1 by applying a second computation operation to the first auxiliary variable z0; (c) Adding the calculated differential value d to the address variable r as a function of the value of the current bit b i, so that either the memory address of the first auxiliary variable z0 or the memory address of the second auxiliary variable z1 is assigned as a value to the address variable r; (d) Updating the first auxiliary variable z0 by transmitting the value of the auxiliary variable z0, z1, whose memory address is assigned to the address variable r; - After completing the steps for each of the bits b i, outputting the first auxiliary variable z0 as the result of the mathematical operation, wherein in step (c) the differential value d is added to the address variable r as a function of the value of the current bit b i by - a first computer word h1 being formed, wherein the current bit b i is the least significant bit LSB in the sequential processing; - the first computer word h1 being multiplied by the difference to form a first product m; - the first product m1 being subtracted from the address variable r; - a second computer word h2 being formed from the first computer word h1, by setting the least significant bit LSB to zero; - the second computer word h2 being multiplied by the difference d to form a second product m2; - the second product m2 being added to the address variable r. - Initializing a first auxiliary variable z0 and a second auxiliary variable z1; - Determining a memory address respectively for the first z0 and second auxiliary variable z1 and assigning the first memory address to an address variable r; - Calculating a differential value d from the difference between the memory addresses; - Implementing the following steps sequentially for each bit b i starting from the most significant bit MSB: (a) Updating the first auxiliary variable z0 by applying a first computation operation to the first auxiliary variable z0; (b) Updating the second auxiliary variable z1 by applying a second computation operation to the first auxiliary variable z0; (c) Adding the calculated differential value d to the address variable r as a function of the value of the current bit b i, so that either the memory address of the first auxiliary variable z0 or the memory address of the second auxiliary variable z1 is assigned as a value to the address variable r; (d) Updating the first auxiliary variable z0 by transmitting the value of the auxiliary variable z0, z1, whose memory address is assigned to the address variable r; (a) Updating the first auxiliary variable z0 by applying a first computation operation to the first auxiliary variable z0; (b) Updating the second auxiliary variable z1 by applying a second computation operation to the first auxiliary variable z0; (c) Adding the calculated differential value d to the address variable r as a function of the value of the current bit b i, so that either the memory address of the first auxiliary variable z0 or the memory address of the second auxiliary variable z1 is assigned as a value to the address variable r; (d) Updating the first auxiliary variable z0 by transmitting the value of the auxiliary variable z0, z1, whose memory address is assigned to the address variable r; - After completing the steps for each of the bits b i, outputting the first auxiliary variable z0 as the result of the mathematical operation, - a first computer word h1 being formed, wherein the current bit b i is the least significant bit LSB in the sequential processing; - the first computer word h1 being multiplied by the difference to form a first product m; - the first product m1 being subtracted from the address variable r; - a second computer word h2 being formed from the first computer word h1, by setting the least significant bit LSB to zero; - the second computer word h2 being multiplied by the difference d to form a second product m2; - the second product m2 being added to the address variable r.