<html>
<head>
<style>
  html{
    background-color: #010905;

  }
h2 {
color: #FF6384;
text-align: center;
}

h4 {
color: #123456;
margin: 1px auto;
font-size: 24px;
}

.predescription {
  font-size: 18px;
  font-style: italic;
  color: #4c4d33;
  text-align: left;
  padding-left: 18px;
  width: 100%;
margin-top: 5px;
  margin-bottom: 5px;

  /* Additional text parameters */
  font-weight: bold;
  text-transform: initial;
  letter-spacing: 0px;
  line-height: 1.5;
  text-decoration: normal;
  text-shadow: 2px 2px 4px rgba(2, 2, 25, 0.5);
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'monospace', sans-serif;
  text-overflow: ellipsis;
  --overflow: hidden;
  hyphens: auto;
}

div {
border: 2px solid #f1f5f9;
border-radius:5px;
padding: 5px;

}
.description {
  font-size: 18px;
  font-style: italic;
  color: #4c4d33;
  padding-left: 18px;
  text-align: left;
margin-top: -20px;
  margin-bottom: -15px;
  width: 100%;

  /* Additional text parameters */
  font-weight: 100;
  text-transform: initial;
  letter-spacing: 0px;
  line-height: 1.5;
  text-decoration: normal;
  text-shadow: 2px 2px 4px rgba(2, 2, 25, 0.5);
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'monospace', sans-serif;
  text-overflow: ellipsis;
  --overflow: hidden;
  hyphens: auto;
}
</style>
</head>
<body>
<h2>RSA Encryption Algorithm Visualization</h2>
<div>
<h4>🔒 Select two distinct prime numbers, p and q:</h4>
<p class='predescription'>→ Get special numbers that can only be divided evenly by 1 and themselves. Pick two different special numbers.
</p>
<br>
<p class='description'>Imagine picking two unique and extraordinary friends for a game. These friends, represented by the prime numbers p and q, possess exceptional qualities just like star players in a game. Similar to how these friends stand out from the crowd, prime numbers can only be divided evenly by 1 and themselves. The distinctness of p and q ensures a solid foundation for the RSA encryption algorithm, creating a perfect duo for an extraordinary adventure.</p>
<br>
</div>

<div>
<h4>✖️ Calculate n by multiplying p and q: n = p * q</h4>
<p class='predescription'>→ Combine the two special numbers into a larger number.
</p>
<br>
<p class='description'>Combining the powers of two extraordinary forces, represented by the prime numbers p and q, is like multiplying the strengths of two special players. Just as their strengths multiply when they join forces, the numbers p and q multiply to form a new and powerful number, n. This multiplication creates a robust and unbreakable lock mechanism that protects your valuable secrets, serving as the cornerstone of the RSA encryption algorithm.</p>
<br>
</div>

<div>
<h4>⚖️ Calculate Euler's totient function of n: φ(n) = (p-1) * (q-1)</h4>
<p class='predescription'>→ Do a magic trick that counts how many numbers play nicely with the larger number.</p>
<br>
<p class='description'>Euler's totient function, represented by φ(n), is like a mysterious magic trick that counts how many numbers form a harmonious relationship with the larger number, n. Just as the special numbers had no common factors with the larger number in the previous step, these numbers also have no common factors. The totient function, like a magician's wand, reveals this hidden count, holding the key to unlocking the secrets of encryption and decryption in the RSA algorithm.</p><br>
</div>

<div>
<h4>🔑 Select a public exponent e, relatively prime to φ(n)</h4>
<p class='predescription'>→ Choose a magic number that doesn't have any common factors with the result of the magic trick.
</p>
<br>
<p class='description'>Choosing a public exponent, denoted as e, is like finding a special key that unlocks the encryption process. This key, represented by the letter 'e', must be uniquely different from the result obtained in the previous step. Just like a key code completely different from a magic trick result, the public exponent ensures secure encryption by having no common factors with Euler's totient function of n (φ(n)).</p>
<br>
</div>

<div>
<h4>🔢 Calculate the private exponent d, satisfying (d * e) % φ(n) = 1</h4>
<p class='predescription'>→ Through some mathematical magic, find a secret number that, when multiplied by the magic number and divided by the result of the magic trick, results in an answer of 1.
</p>
<br>
<p class='description'>Calculating the private exponent, represented by d, is like solving a math puzzle to discover the secret number that, when multiplied by the public exponent 'e' and divided by Euler's totient function of n (φ(n)), equals 1. This special number, known only to the owner, unlocks and decrypts messages encrypted using the public key. The relationship between d, e, and φ(n) guarantees the ability to reverse the encryption process and reveal the original message.</p>
<br>
</div>

<div>
<h4>🌐 Public Key: (e, n)</h4>
<p class='predescription'>→ The public key is like a toy that everyone can play with. It has two numbers: the magic number and the larger number.
</p>
<br>
<p class='description'>The public key, represented as (e, n), is like a toy that can be freely shared among friends. It consists of two numbers: the public exponent, e, and the larger number, n. Just as a toy brings joy to multiple people, the public key enables secure communication between sender and recipient. The magic number, e, serves as the key to unlocking the encryption process, and the larger number, n, forms the foundation of the encryption algorithm.</p>
<br>
</div>

<div>
<h4>📂 Encryption: To encrypt a message M, compute C = (M^e) % n</h4>
<p class='predescription'>→ Imagine you have a secret message. Put that message inside a special box, raise it to the power of the magic number, and take the remainder when divided by the larger number. The result is the encrypted message.
</p>
<br>
<p class='description'>Encryption is like sealing a secret message inside a special box. To encrypt a message M, we raise it to the power of the public exponent, e, and then take the remainder when divided by the larger number, n. This transformation turns the message into an unreadable form, represented by the ciphertext, C. It's like protecting the secret message with an unbreakable seal, ensuring that only the intended recipient with the private key can unlock and read it.</p>
<br>
</div>

<div>
<h4>🔓 Decryption: To decrypt the ciphertext C, compute M = (C^d) % n</h4>
<p class='predescription'>→ If you have the encrypted message and the secret numbers, take the encrypted message, raise it to the power of the secret number, and take the remainder when divided by the larger number. The result will be the original secret message.
</p>
<br>
<p class='description'>Decryption is like using a special key to unlock a sealed box and reveal the original secret message. To decrypt the ciphertext C, we raise it to the power of the private exponent, d, and then take the remainder when divided by the larger number, n. This reverse transformation, using the private key associated with the public key used for encryption, turns the ciphertext back into the original message, represented by M. It's like unlocking the sealed box and retrieving the hidden treasure inside. Only the intended recipient with the private key can decrypt and read the message.</p>
<br>
</div>
</body>
</html>