A computer-implemented method comprising: receiving an input message 'm' at a processor executing a signature algorithm; generating, by the processor, a first random value 'r' that is used to blind the signature calculation to prevent a side-channel analysis attack; computing, by the processor, a second random value 'h', by multiplying modulo a public modulus 'n' the first random value and the square of a factor 'R' used to create a Montgomery form of the input message; and computing, by the processor, a signature by computing a first intermediate value 'v' by multiplying, using Montgomery multiplication, 'h' with 1, where v = r R mod n; computing a second intermediate value 'k' by raising v to the power e-1 using Montgomery multiplication, where k = r e-1 R mod n, where `e' is a public exponent; computing a third intermediate value 'j' by multiplying k by m using Montgomery multiplication, where j = r e-1 m mod n; and computing a fourth intermediate value 'p' by multiplying j by h using Montgomery multiplication, where p = r e m R mod n; and Montgomery multiplying the third intermediate value 'j' by the fourth intermediate value 'p' raised to the power d-1 using Montgomery multiplication to produce the signature 'S,' wherein S = p d-1 j mod n, where 'd' is a private exponent. receiving an input message 'm' at a processor executing a signature algorithm; generating, by the processor, a first random value 'r' that is used to blind the signature calculation to prevent a side-channel analysis attack; computing, by the processor, a second random value 'h', by multiplying modulo a public modulus 'n' the first random value and the square of a factor 'R' used to create a Montgomery form of the input message; and computing, by the processor, a signature by computing a first intermediate value 'v' by multiplying, using Montgomery multiplication, 'h' with 1, where v = r R mod n; computing a second intermediate value 'k' by raising v to the power e-1 using Montgomery multiplication, where k = r e-1 R mod n, where `e' is a public exponent; computing a third intermediate value 'j' by multiplying k by m using Montgomery multiplication, where j = r e-1 m mod n; and computing a fourth intermediate value 'p' by multiplying j by h using Montgomery multiplication, where p = r e m R mod n; and Montgomery multiplying the third intermediate value 'j' by the fourth intermediate value 'p' raised to the power d-1 using Montgomery multiplication to produce the signature 'S,' wherein S = p d-1 j mod n, where 'd' is a private exponent. computing a first intermediate value 'v' by multiplying, using Montgomery multiplication, 'h' with 1, where v = r R mod n; computing a second intermediate value 'k' by raising v to the power e-1 using Montgomery multiplication, where k = r e-1 R mod n, where `e' is a public exponent; computing a third intermediate value 'j' by multiplying k by m using Montgomery multiplication, where j = r e-1 m mod n; and computing a fourth intermediate value 'p' by multiplying j by h using Montgomery multiplication, where p = r e m R mod n; and Montgomery multiplying the third intermediate value 'j' by the fourth intermediate value 'p' raised to the power d-1 using Montgomery multiplication to produce the signature 'S,' wherein S = p d-1 j mod n, where 'd' is a private exponent.