1. A computer-implemented method for securely encrypting or decrypting a message or verifying a digital signature of a message by applying a mathematical operation to the message using a key, the method comprising: inputting the key represented as a binary number with a sequence of bits; initializing a first auxiliary variable and a second auxiliary variable; determining first and second memory addresses respectively for the first and second auxiliary variables and assigning the first memory address to an address variable; calculating a differential value from a difference between the memory addresses; sequentially performing, by a computer, the following steps for each bit of the binary number starting from a most significant bit: (a) updating the first auxiliary variable by applying a first computation operation to the first auxiliary variable; (b) updating the second auxiliary variable by applying a second computation operation to the first auxiliary variable; (c) adding the differential value to the address variable as a function of the value of the current bit, so that either the memory address value of the first auxiliary variable or the memory address value of the second auxiliary variable is assigned to the address variable; and (d) updating the first auxiliary variable by using the auxiliary variable, whose memory address is assigned to the address variable; and after completing steps (a) through (d) for each bit, outputting the first auxiliary variable as a result of the mathematical operation and securely encrypting or decrypting the message or verifying a digital signature of the message by applying the mathematical operation to the message using the key, wherein the first auxiliary variable represents a point on an elliptic curve over a finite field, the first auxiliary variable is initialized to a first computation operation includes a scalar multiplication of the point by a factor 2, the second computation operation comprises adding the point and a permanently predefined point on the elliptic curve, and the mathematical operation comprises a scalar multiplication of the key and the permanently predefined point on the elliptic curve.