# Euler's totient function and Carmichael's totient function in RSA [duplicate]

This question already has an answer here:

I'm a high school student taking IB and I'm doing my EE on Maths, more specifically on the effectiveness of Euler's totient function and Carmichael's totient function in RSA.

1. Am I right in thinking that Euler's and Carmichael's can be used interchangeably to generate the public key in RSA?
2. To compare their 'effectiveness' I will first compare the amount of time it takes to generate a public key using each function based on time complexity. Secondly, I want to compare the security of the public key (meaning 'how difficult it is to guess the private key given the public key'). But how? Is there an algorithm to use to test the security of an encryption key?

Many thanks!

## marked as duplicate by Ilmari Karonen, kelalaka, AleksanderRas, Squeamish Ossifrage, Maarten Bodewes♦ encryption StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Apr 18 at 23:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

## 1 Answer

1. Am I right in thinking that Euler's and Carmichael's can be used interchangeably to generate the public key in RSA?

Yes. The requirement is that the public exponent $$e$$ have an inverse modulo $$\phi(n)$$ or $$\lambda(n)$$, whichever you use—and the two numbers share prime factorization, differing only in multiplicity, so $$e$$ is coprime with $$\phi(n)$$ iff $$e$$ is coprime with $$\lambda(n)$$.

1. To compare their 'effectiveness' I will first compare the amount of time it takes to generate a public key using each function based on time complexity. Secondly, I want to compare the security of the public key (meaning 'how difficult it is to guess the private key given the public key'). But how? Is there an algorithm to use to test the security of an encryption key?

There is no algorithm to test the security of a particular key. There is literature on the security of systems for generating keys, though—and for RSA keys there are many such systems[1], with some pitfalls if you're not careful about using the fancy ones[2].

However, this is all about generation of the prime factors. The public exponent $$e$$ should be a fixed constant like 3 or 65537; then the private exponent $$d$$ solves either $$e\cdot d \equiv 1 \pmod{\phi(n)}$$ or $$e\cdot d \equiv 1 \pmod{\lambda(n)}$$. If you use $$\phi(n)$$, $$d$$ might be larger, so the private key operation costs more to do the same thing. That is, the only difference the choice of $$\phi(n)$$ vs. $$\lambda(n)$$ makes is efficiency of the private key operation.

• I'm noticing the use of the word 'cost' in many tech-y writings... What does that mean? – dkssud10 May 19 at 5:28