tanszek:oktatas:techcomm:rsa_encryption
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tanszek:oktatas:techcomm:rsa_encryption [2024/10/07 13:28] – [RSA] knehez | tanszek:oktatas:techcomm:rsa_encryption [2024/11/26 08:25] (current) – [Example] knehez | ||
---|---|---|---|
Line 1: | Line 1: | ||
==== The Basic Model of Public Key Systems ==== | ==== The Basic Model of Public Key Systems ==== | ||
- | |||
- | === Basic communication model === | ||
{{: | {{: | ||
Line 70: | Line 68: | ||
2.) **Compute \( N \)** (the modulus): | 2.) **Compute \( N \)** (the modulus): | ||
- | \[ | + | |
+ | \[ | ||
N = p \times q = 61 \times 53 = 3233 | N = p \times q = 61 \times 53 = 3233 | ||
- | \] | + | \] |
So, \( N = 3233 \). | So, \( N = 3233 \). | ||
3.) **Compute Euler’s totient function** \( \phi(N) \): | 3.) **Compute Euler’s totient function** \( \phi(N) \): | ||
- | \[ | + | |
+ | \[ | ||
| | ||
- | \] | + | \] |
So, \( \phi(N) = 3120 \). | So, \( \phi(N) = 3120 \). | ||
Line 85: | Line 85: | ||
5. **Calculate the private exponent** \( d \), which is the modular multiplicative inverse of \( e \mod \phi(N) \): | 5. **Calculate the private exponent** \( d \), which is the modular multiplicative inverse of \( e \mod \phi(N) \): | ||
- | \[ | + | \[ |
d \times e \equiv 1 \mod \phi(N) | d \times e \equiv 1 \mod \phi(N) | ||
- | \] | + | \] |
Using the extended Euclidean algorithm, we find that \( d = 2753 \). | Using the extended Euclidean algorithm, we find that \( d = 2753 \). | ||
Line 97: | Line 97: | ||
2.) **Encryption formula**: | 2.) **Encryption formula**: | ||
- | \[ | + | \[ |
c = m^e \mod N | c = m^e \mod N | ||
- | \] | + | \] |
* \( m = 65 \), \( e = 17 \), \( N = 3233 \). | * \( m = 65 \), \( e = 17 \), \( N = 3233 \). | ||
* Compute \( 65^{17} \mod 3233 \): | * Compute \( 65^{17} \mod 3233 \): | ||
Using modular exponentiation: | Using modular exponentiation: | ||
- | \[ | + | \[ |
| | ||
- | \] | + | \] |
So, the **ciphertext** \( c = 2790 \). | So, the **ciphertext** \( c = 2790 \). | ||
Line 115: | Line 115: | ||
1.) **Private key** is \( (d, N) = (2753, 3233) \). | 1.) **Private key** is \( (d, N) = (2753, 3233) \). | ||
+ | |||
2.) **Decryption formula**: | 2.) **Decryption formula**: | ||
- | \[ | + | \[ |
m = c^d \mod N | m = c^d \mod N | ||
- | \] | + | \] |
* \( c = 2790 \), \( d = 2753 \), \( N = 3233 \). | * \( c = 2790 \), \( d = 2753 \), \( N = 3233 \). | ||
* Compute \( 2790^{2753} \mod 3233 \): | * Compute \( 2790^{2753} \mod 3233 \): | ||
Again, using modular exponentiation: | Again, using modular exponentiation: | ||
- | \[ | + | \[ |
| | ||
- | \] | + | \] |
Thus, Alice successfully decrypts the message and retrieves the original plaintext **65**. | Thus, Alice successfully decrypts the message and retrieves the original plaintext **65**. | ||
- | ### Summary of the RSA Example: | + | === Summary of the RSA Example: |
* Public key: \( (e = 17, N = 3233) \) | * Public key: \( (e = 17, N = 3233) \) |
tanszek/oktatas/techcomm/rsa_encryption.1728307735.txt.gz · Last modified: 2024/10/07 13:28 by knehez