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

More Related Content

What's hot (20)

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

Viewers also liked (13)

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

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

PDF
D017433134
IOSR Journals
 
PDF
Presentation on Cryptography_Based on IEEE_Paper
Nithin Cv
 
PPT
Nwc rsa
anupamnm
 
PDF
Ch34508510
IJERA Editor
 
PDF
Generate an Encryption Key by using Biometric Cryptosystems to secure transfe...
IOSR Journals
 
PDF
White Paper on Cryptography
Durgesh Malviya
 
DOC
Unit 3(1)
Vinod Kumar Gorrepati
 
PPTX
encryption and decryption ,and its types
josereena1
 
PDF
An Advance Approach of Image Encryption using AES, Genetic Algorithm and RSA ...
IJEACS
 
PDF
Vtu network security(10 ec832) unit 2 notes..
Jayanth Dwijesh H P
 
PPT
Kleptography
Erfan Mallick
 
PDF
Analysis of Cryptographic Algorithms
ijsrd.com
 
PPT
Introduction to cryptography
Suresh Thammishetty
 
DOCX
Unit 3(1)
Vinod Kumar Gorrepati
 
PDF
Survey on asymmetric key cryptography algorithms
Editor Jacotech
 
PDF
Ch12 Encryption
phanleson
 
PDF
A survey on Fully Homomorphic Encryption
iosrjce
 
PDF
B017631014
IOSR Journals
 
PPTX
RSA-Algorithm-in-Modular-Arithmetic11 (1) (1).pptx
SiddhanthAlape
 
PPT
Chapter 15 - Security
Wayne Jones Jnr
 
D017433134
IOSR Journals
 
Presentation on Cryptography_Based on IEEE_Paper
Nithin Cv
 
Nwc rsa
anupamnm
 
Ch34508510
IJERA Editor
 
Generate an Encryption Key by using Biometric Cryptosystems to secure transfe...
IOSR Journals
 
White Paper on Cryptography
Durgesh Malviya
 
encryption and decryption ,and its types
josereena1
 
An Advance Approach of Image Encryption using AES, Genetic Algorithm and RSA ...
IJEACS
 
Vtu network security(10 ec832) unit 2 notes..
Jayanth Dwijesh H P
 
Kleptography
Erfan Mallick
 
Analysis of Cryptographic Algorithms
ijsrd.com
 
Introduction to cryptography
Suresh Thammishetty
 
Survey on asymmetric key cryptography algorithms
Editor Jacotech
 
Ch12 Encryption
phanleson
 
A survey on Fully Homomorphic Encryption
iosrjce
 
B017631014
IOSR Journals
 
RSA-Algorithm-in-Modular-Arithmetic11 (1) (1).pptx
SiddhanthAlape
 
Chapter 15 - Security
Wayne Jones Jnr
 
Ad

Recently uploaded (20)

PDF
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
PPTX
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
PDF
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
PPTX
Perfecting XM Cloud for Multisite Setup.pptx
Ahmed Okour
 
PPTX
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PPTX
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PDF
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
PDF
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PPTX
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
PPTX
Engineering the Java Web Application (MVC)
abhishekoza1981
 
DOCX
Import Data Form Excel to Tally Services
Tally xperts
 
PDF
Executive Business Intelligence Dashboards
vandeslie24
 
PDF
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
PPTX
How Odoo Became a Game-Changer for an IT Company in Manufacturing ERP
SatishKumar2651
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PPTX
Human Resources Information System (HRIS)
Amity University, Patna
 
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
Perfecting XM Cloud for Multisite Setup.pptx
Ahmed Okour
 
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
Engineering the Java Web Application (MVC)
abhishekoza1981
 
Import Data Form Excel to Tally Services
Tally xperts
 
Executive Business Intelligence Dashboards
vandeslie24
 
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
How Odoo Became a Game-Changer for an IT Company in Manufacturing ERP
SatishKumar2651
 
Tally software_Introduction_Presentation
AditiBansal54083
 
Human Resources Information System (HRIS)
Amity University, Patna
 

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