Notes - MCS
Applied Cryptography
Notes - MCS
Applied Cryptography
  • Applied Cryptography
  • Classical (Symmetric) Cryptography
    • Terminology
    • The Players
    • Use Cases
    • Information-Theoretic Security
    • Computational Security
    • Cryptanalysis
    • Practical Approaches
    • Cryptographic Robustness
    • Ciphers
      • Mono-Alphabetic
      • Polylphabetic
    • Rotor Machines
    • Stream Ciphers
  • Modern Symmetric Cryptography
    • Types
    • Symmetric Ciphers
    • Symmetric Block Ciphers
    • Feistel Networks
    • DES (Data Encryption Standard)
    • AES (Advanced Encryption Standard)
    • Stream Ciphers
    • Uniform Random Access
    • Linear Feedback Shift Register (LFSR)
  • Cipher Modes
    • Deployment of (Symmetric) Block Ciphers
    • Stream Cipher Modes
    • Security Reinforcement
  • Cryptographic Hashing
    • Digest functions
    • Rainbow Tables
    • Message Authentication Codes (MAC)
    • Authenticated Encryption
    • Encryption + Authentication
  • RSA & Related Subjects
    • Modular Arithmetic
    • Fast Modular Multiplication
    • The Extended Euclid's Algorithm
    • Linear Maps
    • Fermat's Little Theorem
    • Chinese Remainder Theorem
    • Fermat's Little Theorem
    • Modular Exponentiation
    • Multiplicative Order
    • The Discrete Logarithm Problem
    • Primality tests
    • The Diffie-Hellman Key Exchange Protocol
    • ElGamal Public Key Cryptosystem
    • The Rivest-Shamir-Adleman Cryptosystem
    • Finite Fields
    • Elliptic Curves
    • Diffie-Hellman using elliptic curves
    • Can we do RSA-like things with elliptic curves?
    • The discrete logarithm problem for elliptic curves
    • Secret sharing
    • Quadratic Residues
    • Zero-Knowledge proofs
      • One of two oblivious transfer
      • Coin flipping
      • Zero-knowledge proofs of identity
    • Homomorphic encryption
  • Asymmetric Key Management
    • Design Principles
    • Exploitation of private keys
    • Distribution of public keys
    • Public key (digital) certificates
    • Key pair usage
    • Certification Authorities (CA)
    • Certification Hierarchies
    • Refreshing of asymmetric key pairs
    • Certificate revocation lists (CRL)
    • Validity of signatures
    • Distribution of public key certificates
    • Time Stamping Authority (TSA)
    • PKI (Public Key Infrastructure)
  • Digital Signatures
    • Fundamental Approach
    • Signature Schemes
    • Key Elements
    • The document to sign
    • The signature date
    • The identity of the signatory
    • Optional elements of a digital signature
    • Algorithms
    • RSA signatures
    • ASN.1 digest algorithm prefixes
    • Digital Signature Standard (DSS)
    • Blind Signatures
    • Chaum Blind Signatures
    • Qualified electronic signature
      • Signature devices
    • PKCS #11
    • Microsoft Cryptographic API (CAPI)
    • Long-Term Validation (LTV)
    • LTV Advanced Electronic Signatures (AdES)
Powered by GitBook
On this page
  1. RSA & Related Subjects

The Extended Euclid's Algorithm

Last updated 1 year ago

Euclid's algorithm starts a sequence with aaa and bbb and proceeds by doing modular reductions on consecutive terms of the sequence until zero in reached.

Let the sequence begin with x0=ax_0 = ax0​=a and x1=bx_1 = bx1​=b. At any time, let xk=ska+tkbx_k = s_ka + t_kbxk​=sk​a+tk​b. So, s0=t1=1s_0 = t_1 = 1s0​=t1​=1, and s1=t0=0s_1 = t_0 = 0s1​=t0​=0.

The next term of the sequence is given by xk=xk−2modxk−1x_k = x_{k-2} mod x_{k-1}xk​=xk−2​modxk−1​. Let qk=⌊xk−2xk−1⌋q_k = \lfloor \frac{x_{k-2}}{x_{k-1}} \rfloorqk​=⌊xk−1​xk−2​​⌋.

Then, xk=xk−2−qkxk−1x_k = x_{k-2} - q_kx_{k-1}xk​=xk−2​−qk​xk−1​, sk=sk−2−qksk−1s_k = s_{k-2} - q_ks_{k-1}sk​=sk−2​−qk​sk−1​, and tk=tk−2−qktk−1t_k = t_{k-2} - q_kt_{k-1}tk​=tk−2​−qk​tk−1​.

We have to stop wjem xk=0x_k = 0xk​=0, at which time gcd(a,b)=xk−1gcd(a,b) = x_{k-1}gcd(a,b)=xk−1​. But here we know more: xk−1=sk−1a+tk−1bx_{k-1} = s_{k-1}a + t_{k-1}bxk−1​=sk−1​a+tk−1​b.

If gcd(a,b)=1gcd(a,b) = 1gcd(a,b)=1 then xk−1=1x_{k-1} = 1xk−1​=1, and this formula allows us to compute easily.

  • a−1modb=sk−1modba^{-1} mod b = s_{k-1} mod ba−1modb=sk−1​modb and

  • b−1moda=tk−1modab^{-1}mod a = t_{k-1} mod ab−1moda=tk−1​moda

Example