×
1 Choose EITC/EITCA Certificates
2 Learn and take online exams
3 Get your IT skills certified

Confirm your IT skills and competencies under the European IT Certification framework from anywhere in the world fully online.

EITCA Academy

Digital skills attestation standard by the European IT Certification Institute aiming to support Digital Society development

SIGN IN YOUR ACCOUNT TO HAVE ACCESS TO DIFFERENT FEATURES

CREATE AN ACCOUNT FORGOT YOUR PASSWORD?

FORGOT YOUR DETAILS?

AAH, WAIT, I REMEMBER NOW!

CREATE ACCOUNT

ALREADY HAVE AN ACCOUNT?
EUROPEAN INFORMATION TECHNOLOGIES CERTIFICATION ACADEMY - ATTESTING YOUR PROFESSIONAL DIGITAL SKILLS
  • SIGN UP
  • LOGIN
  • SUPPORT

EITCA Academy

EITCA Academy

The European Information Technologies Certification Institute - EITCI ASBL

Certification Provider

EITCI Institute ASBL

Brussels, European Union

Governing European IT Certification (EITC) framework in support of the IT professionalism and Digital Society

  • CERTIFICATES
    • EITCA ACADEMIES
      • EITCA ACADEMIES CATALOGUE<
      • EITCA/CG COMPUTER GRAPHICS
      • EITCA/IS INFORMATION SECURITY
      • EITCA/BI BUSINESS INFORMATION
      • EITCA/KC KEY COMPETENCIES
      • EITCA/EG E-GOVERNMENT
      • EITCA/WD WEB DEVELOPMENT
      • EITCA/AI ARTIFICIAL INTELLIGENCE
    • EITC CERTIFICATES
      • EITC CERTIFICATES CATALOGUE<
      • COMPUTER GRAPHICS CERTIFICATES
      • WEB DESIGN CERTIFICATES
      • 3D DESIGN CERTIFICATES
      • OFFICE IT CERTIFICATES
      • BITCOIN BLOCKCHAIN CERTIFICATE
      • WORDPRESS CERTIFICATE
      • CLOUD PLATFORM CERTIFICATENEW
    • EITC CERTIFICATES
      • INTERNET CERTIFICATES
      • CRYPTOGRAPHY CERTIFICATES
      • BUSINESS IT CERTIFICATES
      • TELEWORK CERTIFICATES
      • PROGRAMMING CERTIFICATES
      • DIGITAL PORTRAIT CERTIFICATE
      • WEB DEVELOPMENT CERTIFICATES
      • DEEP LEARNING CERTIFICATESNEW
    • CERTIFICATES FOR
      • EU PUBLIC ADMINISTRATION
      • TEACHERS AND EDUCATORS
      • IT SECURITY PROFESSIONALS
      • GRAPHICS DESIGNERS & ARTISTS
      • BUSINESSMEN AND MANAGERS
      • BLOCKCHAIN DEVELOPERS
      • WEB DEVELOPERS
      • CLOUD AI EXPERTSNEW
  • FEATURED
  • SUBSIDY
  • HOW IT WORKS
  •   IT ID
  • ABOUT
  • CONTACT
  • MY ORDER
    Your current order is empty.
EITCIINSTITUTE
CERTIFIED

How can an affine cipher be injective?

by Emmanuel Udofia / Friday, 09 August 2024 / Published in Cybersecurity, EITC/IS/CCF Classical Cryptography Fundamentals, History of cryptography, Modular arithmetic and historical ciphers

An affine cipher is a type of monoalphabetic substitution cipher that uses mathematical functions to encrypt and decrypt messages. Specifically, the encryption function of an affine cipher uses a linear transformation of the form:

    \[ E(x) = (ax + b) \mod m \]

where:
– x is the numerical equivalent of the plaintext letter.
– a and b are constants that serve as the key to the cipher.
– m is the size of the alphabet (e.g., m = 26 for the English alphabet).

For the affine cipher to be injective, which means each input maps to a unique output (i.e., it is a one-to-one function), the key component a must have a specific property. This property is that a must be coprime with m. Two numbers are coprime if their greatest common divisor (GCD) is 1.

Injectivity and Coprimality

To understand why a must be coprime with m for the affine cipher to be injective, consider the implications of the encryption function:

    \[ E(x) = (ax + b) \mod m \]

If a and m are not coprime, then there exist integers k and l such that:

    \[ \gcd(a, m) = d > 1 \]

This means that a and m share a common factor d. Consequently, there would be multiple values of x that, when multiplied by a and reduced modulo m, could produce the same result. This violates the injectivity requirement because different plaintext letters would map to the same ciphertext letter.

Example of Non-Injectivity

Consider an alphabet of size m = 26 and choose a = 13 and b = 5. The encryption function becomes:

    \[ E(x) = (13x + 5) \mod 26 \]

Since \gcd(13, 26) = 13 \neq 1, a and m are not coprime. Let's examine the mapping for x = 0 and x = 2:

For x = 0:

    \[ E(0) = (13 \cdot 0 + 5) \mod 26 = 5 \]

For x = 2:

    \[ E(2) = (13 \cdot 2 + 5) \mod 26 = (26 + 5) \mod 26 = 5 \]

Both x = 0 and x = 2 map to the same ciphertext letter, 5, demonstrating non-injectivity.

Ensuring Injectivity

To ensure the affine cipher is injective, a must be chosen such that \gcd(a, m) = 1. This guarantees that a has a multiplicative inverse modulo m, which is important for decrypting the message. The decryption function is given by:

    \[ D(y) = a^{-1}(y - b) \mod m \]

where a^{-1} is the multiplicative inverse of a modulo m. The multiplicative inverse a^{-1} exists if and only if \gcd(a, m) = 1.

Example of Injectivity

Consider again an alphabet of size m = 26, but this time choose a = 7 and b = 3. The encryption function is:

    \[ E(x) = (7x + 3) \mod 26 \]

Since \gcd(7, 26) = 1, a and m are coprime, ensuring injectivity. Let's examine the mapping for x = 0 and x = 2:

For x = 0:

    \[ E(0) = (7 \cdot 0 + 3) \mod 26 = 3 \]

For x = 2:

    \[ E(2) = (7 \cdot 2 + 3) \mod 26 = (14 + 3) \mod 26 = 17 \]

Here, x = 0 maps to 3 and x = 2 maps to 17, demonstrating that different plaintext letters map to different ciphertext letters, thus maintaining injectivity.

Decryption with Injectivity

Given the encryption function E(x) = (7x + 3) \mod 26, we need to find the multiplicative inverse of 7 modulo 26 to decrypt the message. The multiplicative inverse a^{-1} satisfies:

    \[ 7a^{-1} \equiv 1 \mod 26 \]

Using the Extended Euclidean Algorithm, we find that the multiplicative inverse of 7 modulo 26 is 15 because:

    \[ 7 \cdot 15 \mod 26 = 105 \mod 26 = 1 \]

Thus, the decryption function is:

    \[ D(y) = 15(y - 3) \mod 26 \]

Let's decrypt the ciphertext letter 17:

    \[ D(17) = 15(17 - 3) \mod 26 = 15 \cdot 14 \mod 26 = 210 \mod 26 = 2 \]

This shows that the decryption process correctly recovers the original plaintext letter.

An affine cipher can be injective if and only if the constant a used in the encryption function is coprime with the size of the alphabet m. This ensures a one-to-one mapping between plaintext and ciphertext letters, making the cipher both secure and reversible. The injectivity of the affine cipher is important for maintaining the integrity of the encrypted message and ensuring that each plaintext letter maps to a unique ciphertext letter, and vice versa.

Other recent questions and answers regarding EITC/IS/CCF Classical Cryptography Fundamentals:

  • Is cryptography considered a part of cryptology and cryptanalysis?
  • Will a shift cipher with a key equal to 4 replace the letter d with the letter h in ciphertext?
  • Does the ECB mode breaks large input plaintext into subsequent blocks
  • Do identical plaintext map to identical cipher text of a letter frequency analysis attact against a substitution cipher
  • What is EEA ?
  • Are brute force attack always an exhausive key search?
  • In RSA cipher, does Alice need Bob’s public key to encrypt a message to Bob?
  • Can we use a block cipher to build a hash function or MAC?
  • What are initialization vectors?
  • How many part does a public and private key has in RSA cipher

View more questions and answers in EITC/IS/CCF Classical Cryptography Fundamentals

More questions and answers:

  • Field: Cybersecurity
  • Programme: EITC/IS/CCF Classical Cryptography Fundamentals (go to the certification programme)
  • Lesson: History of cryptography (go to related lesson)
  • Topic: Modular arithmetic and historical ciphers (go to related topic)
Tagged under: Affine Cipher, Cybersecurity, Decryption, Encryption, Injectivity, Modular Arithmetic
Home » Cybersecurity / EITC/IS/CCF Classical Cryptography Fundamentals / History of cryptography / Modular arithmetic and historical ciphers » How can an affine cipher be injective?

Certification Center

USER MENU

  • My Account

CERTIFICATE CATEGORY

  • EITC Certification (106)
  • EITCA Certification (9)

What are you looking for?

  • Introduction
  • How it works?
  • EITCA Academies
  • EITCI DSJC Subsidy
  • Full EITC catalogue
  • Your order
  • Featured
  •   IT ID
  • EITCA reviews (Reddit publ.)
  • About
  • Contact
  • Cookie Policy (EU)

EITCA Academy is a part of the European IT Certification framework

The European IT Certification framework has been established in 2008 as a Europe based and vendor independent standard in widely accessible online certification of digital skills and competencies in many areas of professional digital specializations. The EITC framework is governed by the European IT Certification Institute (EITCI), a non-profit certification authority supporting information society growth and bridging the digital skills gap in the EU.

    EITCA Academy Secretary Office

    European IT Certification Institute ASBL
    Brussels, Belgium, European Union

    EITC / EITCA Certification Framework Operator
    Governing European IT Certification Standard
    Access contact form or call +32 25887351

    Follow EITCI on Twitter
    Visit EITCA Academy on Facebook
    Engage with EITCA Academy on LinkedIn
    Check out EITCI and EITCA videos on YouTube

    Funded by the European Union

    Funded by the European Regional Development Fund (ERDF) and the European Social Fund (ESF), governed by the EITCI Institute since 2008

    Information Security Policy | DSRRM and GDPR Policy | Data Protection Policy | Record of Processing Activities | HSE Policy | Anti-Corruption Policy | Modern Slavery Policy

    Automatically translate to your language

    Terms and Conditions | Privacy Policy
    Follow @EITCI
    EITCA Academy

    Your browser doesn't support the HTML5 CANVAS tag.

    • Quantum Information
    • Artificial Intelligence
    • Cybersecurity
    • Cloud Computing
    • Web Development
    • GET SOCIAL
    EITCA Academy


    © 2008-2026  European IT Certification Institute
    Brussels, Belgium, European Union

    TOP
    CHAT WITH SUPPORT
    Do you have any questions?
    We will reply here and by email. Your conversation is tracked with a support token.