SlideShare a Scribd company logo
6
Most read
8
Most read
9
Most read
ENCRYPTION-DECRYPTION
of Devanagri Script Using Affine Cipher
Team :
Astha Goel
Harshit Bhatia
Mohit Singhal
Prachi Gupta
Swati Nagpal
Deen Dayal Upadhaya College
Objective
To design and implement an
Encryption/Decryption scheme based on affine
cipher for plain text in Devanagri(Unicode)
communicating message in Hindi.
Also, to develop a solver which solves the
crypt when the encryption parameters(key)
are not known.
Introduction
CRYPTOGRAPHY
Cryptography, derived from Greek words
krptos- secret and graphy- writing.
 It is the science of using mathematics to hide
information.
 With the help of Cryptography we can store sensitive
information, or transmit it over insecure networks
(such as the internet) so that it can only be read by the
intended recipient.
Encryption
Encryption is the process of converting readable data
(called the plaintext) into a form which hides its
content, called the ciphertext.
Decryption
Decryption is the reverse process, with a ciphertext
converted back into the corresponding plaintext.
NOTE:
Cryptography should not be confused with encryption.
The name encryption itself defines the basic difference.
EN-CRYPT: “en” means to make and “crypt or crypto”
means hidden or secret.
Hence, Encryption is a fundamental tool for protection of
information while Cryptography is the method of
transforming the representation of information for secured
transmission of information.
Ciphers
 A cipher is a mathematical function used in the
encryption and decryption processes. Most ciphers use
a secret key when encrypting, and different keys will
typically encrypt a given plaintext into different
ciphertexts.
 The key is usually only known by the person who
encrypts the data, and the intended recipient.The
secrecy of the key ensures that even if an
eavesdropper were to intercept the transmitted data,
they would be unable to decrypt it.
In general the security of encrypted data is
dependent on two factors:
1. The strength of the cipher.
2.The secrecy of the key.
Classes Of Cipher
Affine Cipher
Affine Cipher
The affine cipher is a type of monoalphabetic
substitution cipher, wherein each letter in an alphabet is
mapped to its numeric equivalent, encrypted using a
simple mathematical function, and converted back to a
letter.
Each letter is enciphered with the function ,
E(x)=(ax+b) (mod m)
where modulus m is the size of the alphabet and a and b
are the key of the cipher. The value a must be chosen
such that a and m are coprime.
Also, 0 ≤ a < m, and 0 ≤ b < m
The decryption function is:
D(x) = a-1(x-b) mod{m}
Where a-1 is the modular multiplicative inverse of a
modulo m, i.e. it satisfies the equation:
1=aa-1 mod{m}
Special Cases:
The Caesar Cipher is the Affine cipher when since the
encrypting function simply reduces to a linear shift ie.
when a=1.
The Decimation Cipher is the Affine cipher when the
encryption function reduces to (ax)MOD m as the value
of b=0.
Algorithms
Encryption :
 The value of the appropriate key (ie. Fulfilling the condition of
the affine cipher), and the plaintext in devanagri is asked from
the user.
 The characters from plaintext are mapped according to the
encryption function.The mapped characters are then printed
in the encrypted file using FileUtils class (provided by Apache).
Decryption :
 The values of a & b for the decryption function, and the
encrypted file are asked from the user.
 The pre-image of the characters is hence found and printed in
the decrypted file using FileUtils class( as done in Encryption).
Algorithms
Key Calculation :
Take any two random characters (x1,x2) from plaintext and the
corresponding mapped characters(y1,y2) from ciphertext.
CASE- 1: SOLVING THE SYSTEM OF LINEAR EQUATIONS
(x1, x2 has both odd and even unicodes )
I. Form the equations in terms of a & b by substituting the values of
x & y in the encryption function.
II. We have 2 variables and 2 equations. Solving the equations, we
get the values of a & b.
CASE - 2 BRUTE FORCE
(when both x1 and x2 have even OR odd unicodes only)
I. For all possible values of a( ie. All the co-primes of m less than the
value of m), we check for all the values of b, satisfying the
encryption function.
II. Then this encryption function is checked for the rest of the file text.
If it matches with the rest of the file, the values for a & b are
returned.
III. Otherwise the value of a & b are discarded and the steps I and II are
repeated again and again till the time a consistent value of
key(that matches the key of the rest of the file) is not found.
Note: In this case, more than 1 unique solution is possible.
Time-Complexity
 Encryption: O(n)
 Decryption: O(n)
 Key Calculation:
* Best Case: O(n)/O(1)cz it is not not dependent on the file
size now
*Worst Case: O(m2n)
where m = 128,
n = no. of characters in original
file
Space-Complexity
 Encryption: O(1)
 Decryption: O(1)
 Key Calculation: O(n)
where n = no. of characters in original file
SystemRequirements
SOFTWARE REQUIREMENTS
 Java Development Kit 1.6 (jdk 1.6) or more
 Java Runtime Environment
 Platform (IDE) (for running source code):
NetBeans IDE 7.0.1
MEMORY REQUIREMENTS
 Software: 500 KB
 Implementation Software and Platform: 1 GB
Conclusion
 The key of the affine cipher can be uniquely
found with just 2 characters from the plaintext
and the corresponding mapped characters from
the ciphertext provided the characters have odd
and even unicodes.
 But if unicodes of both the characters are even or
odd(which is somewhat a rare case), we need to
compare the different combinations of key with
the rest of the text to obtain single unique key
for the entire text.
References
Websites:
 http://en.wikipedia.org/wiki/Affine_cipher
 http://www.johndcook.com/blog/2008/12/10/solving
-linear-congruences/
 http://www.math.sunysb.edu/~scott/Book331/Affine
_enciphering.html
 http://www.engineersgarage.com/articles/what-is-
cryptography-encryption?page=1
 http://www.javaranch.com
 http://cryptointro.wordpress.com
Ad

Recommended

Encryption And Decryption
Encryption And Decryption
NA
 
A study of cryptography for satellite applications
A study of cryptography for satellite applications
Rajesh Ishida
 
Cryptography
Cryptography
okolo chukwudumebi prince
 
Data encryption, Description, DES
Data encryption, Description, DES
Huawei Technologies
 
Cryptography - 101
Cryptography - 101
n|u - The Open Security Community
 
Network security and cryptography
Network security and cryptography
Pavithra renu
 
Implementation of-hybrid-cryptography-algorithm
Implementation of-hybrid-cryptography-algorithm
Ijcem Journal
 
Seminar on Encryption and Authenticity
Seminar on Encryption and Authenticity
Hardik Manocha
 
Network Security and Cryptography
Network Security and Cryptography
Adam Reagan
 
Data encryption
Data encryption
Deepam Goyal
 
Encryption presentation final
Encryption presentation final
adrigee12
 
Hybrid encryption ppt
Hybrid encryption ppt
prashantdahake
 
Cryptography
Cryptography
Rutuja Solkar
 
Intro to modern cryptography
Intro to modern cryptography
zahid-mian
 
Cryptography.ppt
Cryptography.ppt
kusum sharma
 
Cryptography and network security
Cryptography and network security
patisa
 
Introduction to Cryptography
Introduction to Cryptography
Seema Goel
 
Cryptography and applications
Cryptography and applications
thai
 
Cryptography
Cryptography
Sagar Janagonda
 
Cryptography
Cryptography
herrberk
 
Information Security Cryptography ( L02- Types Cryptography)
Information Security Cryptography ( L02- Types Cryptography)
Anas Rock
 
Information and network security 31 public key cryptography
Information and network security 31 public key cryptography
Vaibhav Khanna
 
cryptography ppt free download
cryptography ppt free download
Twinkal Harsora
 
Cryptography and network security
Cryptography and network security
Nagendra Um
 
Hybrid Cryptography with examples in Ruby and Go
Hybrid Cryptography with examples in Ruby and Go
Eleanor McHugh
 
Cryptography
Cryptography
Shivanand Arur
 
Itt project
Itt project
Harish Kumar
 
Cryptography
Cryptography
gueste4c97e
 
basic encryption and decryption
basic encryption and decryption
Rashmi Burugupalli
 
Information Security Cryptography ( L03- Old Cryptography Algorithms )
Information Security Cryptography ( L03- Old Cryptography Algorithms )
Anas Rock
 

More Related Content

What's hot (20)

Network Security and Cryptography
Network Security and Cryptography
Adam Reagan
 
Data encryption
Data encryption
Deepam Goyal
 
Encryption presentation final
Encryption presentation final
adrigee12
 
Hybrid encryption ppt
Hybrid encryption ppt
prashantdahake
 
Cryptography
Cryptography
Rutuja Solkar
 
Intro to modern cryptography
Intro to modern cryptography
zahid-mian
 
Cryptography.ppt
Cryptography.ppt
kusum sharma
 
Cryptography and network security
Cryptography and network security
patisa
 
Introduction to Cryptography
Introduction to Cryptography
Seema Goel
 
Cryptography and applications
Cryptography and applications
thai
 
Cryptography
Cryptography
Sagar Janagonda
 
Cryptography
Cryptography
herrberk
 
Information Security Cryptography ( L02- Types Cryptography)
Information Security Cryptography ( L02- Types Cryptography)
Anas Rock
 
Information and network security 31 public key cryptography
Information and network security 31 public key cryptography
Vaibhav Khanna
 
cryptography ppt free download
cryptography ppt free download
Twinkal Harsora
 
Cryptography and network security
Cryptography and network security
Nagendra Um
 
Hybrid Cryptography with examples in Ruby and Go
Hybrid Cryptography with examples in Ruby and Go
Eleanor McHugh
 
Cryptography
Cryptography
Shivanand Arur
 
Itt project
Itt project
Harish Kumar
 
Cryptography
Cryptography
gueste4c97e
 
Network Security and Cryptography
Network Security and Cryptography
Adam Reagan
 
Encryption presentation final
Encryption presentation final
adrigee12
 
Intro to modern cryptography
Intro to modern cryptography
zahid-mian
 
Cryptography and network security
Cryptography and network security
patisa
 
Introduction to Cryptography
Introduction to Cryptography
Seema Goel
 
Cryptography and applications
Cryptography and applications
thai
 
Cryptography
Cryptography
herrberk
 
Information Security Cryptography ( L02- Types Cryptography)
Information Security Cryptography ( L02- Types Cryptography)
Anas Rock
 
Information and network security 31 public key cryptography
Information and network security 31 public key cryptography
Vaibhav Khanna
 
cryptography ppt free download
cryptography ppt free download
Twinkal Harsora
 
Cryptography and network security
Cryptography and network security
Nagendra Um
 
Hybrid Cryptography with examples in Ruby and Go
Hybrid Cryptography with examples in Ruby and Go
Eleanor McHugh
 

Viewers also liked (13)

basic encryption and decryption
basic encryption and decryption
Rashmi Burugupalli
 
Information Security Cryptography ( L03- Old Cryptography Algorithms )
Information Security Cryptography ( L03- Old Cryptography Algorithms )
Anas Rock
 
Md5
Md5
bkaa09303
 
5 Cryptography Part1
5 Cryptography Part1
Alfred Ouyang
 
Copyright in india
Copyright in india
Veeral Bhateja
 
Encryption
Encryption
Nitin Parbhakar
 
Copyright (presentation)
Copyright (presentation)
Gagan Varshney
 
Image encryption and decryption
Image encryption and decryption
Aashish R
 
cryptography
cryptography
Abhijeet Singh
 
Cryptography
Cryptography
Darshini Parikh
 
Cryptography.ppt
Cryptography.ppt
Uday Meena
 
Copyright Act 1957
Copyright Act 1957
Dr.Suresh Isave
 
Cryptography
Cryptography
Sidharth Mohapatra
 
basic encryption and decryption
basic encryption and decryption
Rashmi Burugupalli
 
Information Security Cryptography ( L03- Old Cryptography Algorithms )
Information Security Cryptography ( L03- Old Cryptography Algorithms )
Anas Rock
 
5 Cryptography Part1
5 Cryptography Part1
Alfred Ouyang
 
Copyright (presentation)
Copyright (presentation)
Gagan Varshney
 
Image encryption and decryption
Image encryption and decryption
Aashish R
 
Cryptography.ppt
Cryptography.ppt
Uday Meena
 
Ad

Similar to Encryption/Decryption Algorithm for Devanagri Script(Affine Cipher) (20)

Encryption basics
Encryption basics
Kevin OBrien
 
classical of cryptography and the security of the newtork
classical of cryptography and the security of the newtork
Dr. T. Kalaikumaran
 
module 1 (part A).pdf
module 1 (part A).pdf
ChethanKrishna14
 
ASCII Value Based Encryption System (AVB)
ASCII Value Based Encryption System (AVB)
IJERA Editor
 
cryptography symmentric.pptx
cryptography symmentric.pptx
ChethanKrishna14
 
Cryptography cryptography CryptographyCryptography
Cryptography cryptography CryptographyCryptography
rohanbawadkar
 
Edward Schaefer
Edward Schaefer
Information Security Awareness Group
 
Chapter 3.0.pptx and image processing of security
Chapter 3.0.pptx and image processing of security
yhalemayalu
 
Cryptography.ppt
Cryptography.ppt
bcanawakadalcollege
 
Encryption is a process of converting a message, image, or any other .pdf
Encryption is a process of converting a message, image, or any other .pdf
rachanaprade
 
Introductory Lecture on Cryptography and Information Security
Introductory Lecture on Cryptography and Information Security
Bikramjit Sarkar, Ph.D.
 
Cryptography using python
Cryptography using python
KaushikRamabhotla
 
Details with example of Affine Cipher.pptx
Details with example of Affine Cipher.pptx
Geeta Arora
 
CryptX '22 W1 Release (1).pptx
CryptX '22 W1 Release (1).pptx
BhavikaGianey
 
Classic Cryptography
Classic Cryptography
UTD Computer Security Group
 
CS8792 - Cryptography and Network Security
CS8792 - Cryptography and Network Security
vishnukp34
 
Mod1 basics cryptography first module vtu
Mod1 basics cryptography first module vtu
MonaReddy12
 
3 Basics of Cryptography Basics of Cryptography
3 Basics of Cryptography Basics of Cryptography
MohammedMorhafJaely
 
Cryptography and Network Security--MOD-2.pptx
Cryptography and Network Security--MOD-2.pptx
MrsPrajnaUR
 
CISSP - Chapter 3 - Cryptography
CISSP - Chapter 3 - Cryptography
Karthikeyan Dhayalan
 
classical of cryptography and the security of the newtork
classical of cryptography and the security of the newtork
Dr. T. Kalaikumaran
 
ASCII Value Based Encryption System (AVB)
ASCII Value Based Encryption System (AVB)
IJERA Editor
 
cryptography symmentric.pptx
cryptography symmentric.pptx
ChethanKrishna14
 
Cryptography cryptography CryptographyCryptography
Cryptography cryptography CryptographyCryptography
rohanbawadkar
 
Chapter 3.0.pptx and image processing of security
Chapter 3.0.pptx and image processing of security
yhalemayalu
 
Encryption is a process of converting a message, image, or any other .pdf
Encryption is a process of converting a message, image, or any other .pdf
rachanaprade
 
Introductory Lecture on Cryptography and Information Security
Introductory Lecture on Cryptography and Information Security
Bikramjit Sarkar, Ph.D.
 
Details with example of Affine Cipher.pptx
Details with example of Affine Cipher.pptx
Geeta Arora
 
CryptX '22 W1 Release (1).pptx
CryptX '22 W1 Release (1).pptx
BhavikaGianey
 
CS8792 - Cryptography and Network Security
CS8792 - Cryptography and Network Security
vishnukp34
 
Mod1 basics cryptography first module vtu
Mod1 basics cryptography first module vtu
MonaReddy12
 
3 Basics of Cryptography Basics of Cryptography
3 Basics of Cryptography Basics of Cryptography
MohammedMorhafJaely
 
Cryptography and Network Security--MOD-2.pptx
Cryptography and Network Security--MOD-2.pptx
MrsPrajnaUR
 
Ad

Recently uploaded (20)

Building Geospatial Data Warehouse for GIS by GIS with FME
Building Geospatial Data Warehouse for GIS by GIS with FME
Safe Software
 
Complete WordPress Programming Guidance Book
Complete WordPress Programming Guidance Book
Shabista Imam
 
From Code to Commerce, a Backend Java Developer's Galactic Journey into Ecomm...
From Code to Commerce, a Backend Java Developer's Galactic Journey into Ecomm...
Jamie Coleman
 
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
BradBedford3
 
Why Edge Computing Matters in Mobile Application Tech.pdf
Why Edge Computing Matters in Mobile Application Tech.pdf
IMG Global Infotech
 
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
2nd Sight Lab
 
Decipher SEO Solutions for your startup needs.
Decipher SEO Solutions for your startup needs.
mathai2
 
Heat Treatment Process Automation in India
Heat Treatment Process Automation in India
Reckers Mechatronics
 
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
Hassan Abid
 
A Guide to Telemedicine Software Development.pdf
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
 
Best Practice for LLM Serving in the Cloud
Best Practice for LLM Serving in the Cloud
Alluxio, Inc.
 
Which Hiring Management Tools Offer the Best ROI?
Which Hiring Management Tools Offer the Best ROI?
HireME
 
Humans vs AI Call Agents - Qcall.ai's Special Report
Humans vs AI Call Agents - Qcall.ai's Special Report
Udit Goenka
 
Automated Testing and Safety Analysis of Deep Neural Networks
Automated Testing and Safety Analysis of Deep Neural Networks
Lionel Briand
 
Introduction to Agile Frameworks for Product Managers.pdf
Introduction to Agile Frameworks for Product Managers.pdf
Ali Vahed
 
Download Adobe Illustrator Crack free for Windows 2025?
Download Adobe Illustrator Crack free for Windows 2025?
grete1122g
 
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
 
Y - Recursion The Hard Way GopherCon EU 2025
Y - Recursion The Hard Way GopherCon EU 2025
Eleanor McHugh
 
arctitecture application system design os dsa
arctitecture application system design os dsa
za241967
 
Simplify Insurance Regulations with Compliance Management Software
Simplify Insurance Regulations with Compliance Management Software
Insurance Tech Services
 
Building Geospatial Data Warehouse for GIS by GIS with FME
Building Geospatial Data Warehouse for GIS by GIS with FME
Safe Software
 
Complete WordPress Programming Guidance Book
Complete WordPress Programming Guidance Book
Shabista Imam
 
From Code to Commerce, a Backend Java Developer's Galactic Journey into Ecomm...
From Code to Commerce, a Backend Java Developer's Galactic Journey into Ecomm...
Jamie Coleman
 
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
BradBedford3
 
Why Edge Computing Matters in Mobile Application Tech.pdf
Why Edge Computing Matters in Mobile Application Tech.pdf
IMG Global Infotech
 
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
2nd Sight Lab
 
Decipher SEO Solutions for your startup needs.
Decipher SEO Solutions for your startup needs.
mathai2
 
Heat Treatment Process Automation in India
Heat Treatment Process Automation in India
Reckers Mechatronics
 
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
Hassan Abid
 
A Guide to Telemedicine Software Development.pdf
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
 
Best Practice for LLM Serving in the Cloud
Best Practice for LLM Serving in the Cloud
Alluxio, Inc.
 
Which Hiring Management Tools Offer the Best ROI?
Which Hiring Management Tools Offer the Best ROI?
HireME
 
Humans vs AI Call Agents - Qcall.ai's Special Report
Humans vs AI Call Agents - Qcall.ai's Special Report
Udit Goenka
 
Automated Testing and Safety Analysis of Deep Neural Networks
Automated Testing and Safety Analysis of Deep Neural Networks
Lionel Briand
 
Introduction to Agile Frameworks for Product Managers.pdf
Introduction to Agile Frameworks for Product Managers.pdf
Ali Vahed
 
Download Adobe Illustrator Crack free for Windows 2025?
Download Adobe Illustrator Crack free for Windows 2025?
grete1122g
 
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
 
Y - Recursion The Hard Way GopherCon EU 2025
Y - Recursion The Hard Way GopherCon EU 2025
Eleanor McHugh
 
arctitecture application system design os dsa
arctitecture application system design os dsa
za241967
 
Simplify Insurance Regulations with Compliance Management Software
Simplify Insurance Regulations with Compliance Management Software
Insurance Tech Services
 

Encryption/Decryption Algorithm for Devanagri Script(Affine Cipher)

  • 1. ENCRYPTION-DECRYPTION of Devanagri Script Using Affine Cipher Team : Astha Goel Harshit Bhatia Mohit Singhal Prachi Gupta Swati Nagpal Deen Dayal Upadhaya College
  • 2. Objective To design and implement an Encryption/Decryption scheme based on affine cipher for plain text in Devanagri(Unicode) communicating message in Hindi. Also, to develop a solver which solves the crypt when the encryption parameters(key) are not known.
  • 3. Introduction CRYPTOGRAPHY Cryptography, derived from Greek words krptos- secret and graphy- writing.  It is the science of using mathematics to hide information.  With the help of Cryptography we can store sensitive information, or transmit it over insecure networks (such as the internet) so that it can only be read by the intended recipient.
  • 4. Encryption Encryption is the process of converting readable data (called the plaintext) into a form which hides its content, called the ciphertext. Decryption Decryption is the reverse process, with a ciphertext converted back into the corresponding plaintext.
  • 5. NOTE: Cryptography should not be confused with encryption. The name encryption itself defines the basic difference. EN-CRYPT: “en” means to make and “crypt or crypto” means hidden or secret. Hence, Encryption is a fundamental tool for protection of information while Cryptography is the method of transforming the representation of information for secured transmission of information.
  • 6. Ciphers  A cipher is a mathematical function used in the encryption and decryption processes. Most ciphers use a secret key when encrypting, and different keys will typically encrypt a given plaintext into different ciphertexts.  The key is usually only known by the person who encrypts the data, and the intended recipient.The secrecy of the key ensures that even if an eavesdropper were to intercept the transmitted data, they would be unable to decrypt it.
  • 7. In general the security of encrypted data is dependent on two factors: 1. The strength of the cipher. 2.The secrecy of the key.
  • 9. Affine Cipher The affine cipher is a type of monoalphabetic substitution cipher, wherein each letter in an alphabet is mapped to its numeric equivalent, encrypted using a simple mathematical function, and converted back to a letter. Each letter is enciphered with the function , E(x)=(ax+b) (mod m) where modulus m is the size of the alphabet and a and b are the key of the cipher. The value a must be chosen such that a and m are coprime. Also, 0 ≤ a < m, and 0 ≤ b < m
  • 10. The decryption function is: D(x) = a-1(x-b) mod{m} Where a-1 is the modular multiplicative inverse of a modulo m, i.e. it satisfies the equation: 1=aa-1 mod{m} Special Cases: The Caesar Cipher is the Affine cipher when since the encrypting function simply reduces to a linear shift ie. when a=1. The Decimation Cipher is the Affine cipher when the encryption function reduces to (ax)MOD m as the value of b=0.
  • 11. Algorithms Encryption :  The value of the appropriate key (ie. Fulfilling the condition of the affine cipher), and the plaintext in devanagri is asked from the user.  The characters from plaintext are mapped according to the encryption function.The mapped characters are then printed in the encrypted file using FileUtils class (provided by Apache). Decryption :  The values of a & b for the decryption function, and the encrypted file are asked from the user.  The pre-image of the characters is hence found and printed in the decrypted file using FileUtils class( as done in Encryption).
  • 12. Algorithms Key Calculation : Take any two random characters (x1,x2) from plaintext and the corresponding mapped characters(y1,y2) from ciphertext. CASE- 1: SOLVING THE SYSTEM OF LINEAR EQUATIONS (x1, x2 has both odd and even unicodes ) I. Form the equations in terms of a & b by substituting the values of x & y in the encryption function. II. We have 2 variables and 2 equations. Solving the equations, we get the values of a & b.
  • 13. CASE - 2 BRUTE FORCE (when both x1 and x2 have even OR odd unicodes only) I. For all possible values of a( ie. All the co-primes of m less than the value of m), we check for all the values of b, satisfying the encryption function. II. Then this encryption function is checked for the rest of the file text. If it matches with the rest of the file, the values for a & b are returned. III. Otherwise the value of a & b are discarded and the steps I and II are repeated again and again till the time a consistent value of key(that matches the key of the rest of the file) is not found. Note: In this case, more than 1 unique solution is possible.
  • 14. Time-Complexity  Encryption: O(n)  Decryption: O(n)  Key Calculation: * Best Case: O(n)/O(1)cz it is not not dependent on the file size now *Worst Case: O(m2n) where m = 128, n = no. of characters in original file
  • 15. Space-Complexity  Encryption: O(1)  Decryption: O(1)  Key Calculation: O(n) where n = no. of characters in original file
  • 16. SystemRequirements SOFTWARE REQUIREMENTS  Java Development Kit 1.6 (jdk 1.6) or more  Java Runtime Environment  Platform (IDE) (for running source code): NetBeans IDE 7.0.1 MEMORY REQUIREMENTS  Software: 500 KB  Implementation Software and Platform: 1 GB
  • 17. Conclusion  The key of the affine cipher can be uniquely found with just 2 characters from the plaintext and the corresponding mapped characters from the ciphertext provided the characters have odd and even unicodes.  But if unicodes of both the characters are even or odd(which is somewhat a rare case), we need to compare the different combinations of key with the rest of the text to obtain single unique key for the entire text.
  • 18. References Websites:  http://en.wikipedia.org/wiki/Affine_cipher  http://www.johndcook.com/blog/2008/12/10/solving -linear-congruences/  http://www.math.sunysb.edu/~scott/Book331/Affine _enciphering.html  http://www.engineersgarage.com/articles/what-is- cryptography-encryption?page=1  http://www.javaranch.com  http://cryptointro.wordpress.com