A Java Framework for Cryptanalysis using GA (JFCGA)

Arya MirΛογισμικό & κατασκευή λογ/κού

28 Μαρ 2012 (πριν από 5 χρόνια και 7 μήνες)

572 εμφανίσεις

of a Mono Alphabetic Cipher using Genetic Algorithms and Artificial Intelligence. A fitness measure based on the key characteristics of the SPN is proposed and complete problem formulation is described. The complexity of the proposed attack is shown to be less than half of normal cryptanalysis of the same SPN. This article proposes an extension to the Java framework to integrate GA with cryptanalysis.

International Journal of Mathematics Trends and Technology
-
May to June Issue 2011


-

1

-

A Java Framework for Cryptanalysis using
GA (
JFCGA)

N. Naadimuthu

Christ College of Engineering

India



Abstract:

In this paper, a method to discover the key
of a
Mono
Alphabetic Cipher
using Genetic
Algorithms and
Artificial Intelligence
. A
fitness measu
re based on the
key

characteristics of the SPN is proposed and
complete problem formulation is described.
The complexity of the proposed attack is
shown to be less than half of normal
cryptanalysis of the same SPN.

This
article
proposes an extension to the
Java framework
to integrate GA with
cryptanalysis. This

extension also makes it easy for an existing
J
ava
application to be migrated to use
Artificial Intelligence for cryptanalysis
.

We

believe
that such an extension would help
the cryptanalysis
speed up
the
process.



Keywords:

Cryptanalysis, GA, Artificial
Intelligence, Mono Alphabetic Cipher, Key
substitution

I
ntroduction:


Now a day Genetic
Algorithm [
5]
is
the most optimization technique used in many
fields such as Physics,
Biology [
3]
, Economy,
Mathe
matics, and Computer Applications. In
Computer Application Networking is one of
the wide areas which is used to the data
transferring. In the data transferring
cryptography [
8]
is one of the mechanisms

to
send the data with encrypted format. First we
are g
oing to see definitions and short
explanations of the primary key
-
words such as
Artificial Intelligence,
Cryptography [
8]
,
Cryptanalysis [
4]
, and Genetic
Algorithm [
5]
.


1)
Cryptography:


There are many aspects to security
and many applications, ranging fr
om secure
commerce and payments to private
c
ommunications and protecting passwords.
One essential aspect for secure
c
ommunications is that of
cryptography [
8]
. It
is important to note that while
cryptography
[
8]
is
necessary
for secure communications, it
i
s not by itself
sufficient.
Within the context of
any application
-
to
-
application communication,
there are some specific security requirements,
including:



Authentication:
The process of
proving one's identity. (The primary
forms of host
-
to
-
host authenticati
on
on the Internet today are name
-
based or address
-
based, both of
which are notoriously weak.)



Privacy/confidentiality:
Ensuring
that no one can read the message
except the intended receiver.



Integrity:
Assuring the receiver that
the received message has
not been
altered in any way from the original.



Non
-
repudiation:
A mechanism to
prove that the sender really sent this
message.

Cryptanalysis [
6]
is the study of
methods for obtaining the meaning
of encrypted information, without
access to the secret inf
ormation
which is normally required to do so.

2)
A
rtificial
Intelligence:


Artificial intelligence
(AI) is both
the intelligence of machines and the branch
of computer science which aims to create it.
John McCarthy, who invented the term in
1956, defines
it as "the science and
engineering of

making intelligent
machines.".
All AI computer programs are
built on two basic elements: a knowledge
base and an inferencing capability.
(Inferencing means drawing conclusions
based on logic and prior knowledge.) A
kno
wledge base is made up of many discrete
International Journal of Mathematics Trends and Technology
-
May to June Issue 2011


-

2

-

units of information

representing facts,
concepts, theories, procedures, and
relationships

all relevant to a particular
task or aspect of the world. Programs are
written to give the computer the ability to
manipulate
this information and to reason,
make judgments, reach conclusions, and
choose solutions to the problem at hand,
such as guessing whether a series of credit
-
card transactions involves fraud or driving
an automated rover across a rocky Martian
landscape. Wh
ereas conventional,
deterministic software must follow a strictly
logical series of steps to reach a conclusion,
AI software uses the techniques of search

and pattern matching; it may also, in some
cases, modify its knowledge base or its own
structure ("le
arn"). Pattern matching may
still be algorithmic; that is, the computer
must be told exactly where to look in its
knowledge base and what constitutes a
match. The computer searches its knowledge
base for specific conditions or patterns that
fit the criteri
a of the problem to be

solved.
Microchip technology has increased
computational speed, allowing AI programs
to quickly scan huge arrays of data. For
example, computers can scan enough
possible chess moves to provide a
challenging opponent for even the best

human players. Artificial intelligence has
many other applications, including problem
solving in
mathematics
and other fields,
expert systems in medicine, natural

language
processing,
robotics
, and education.

3)
T
rade Off
B
etween Cryptography and

GA

Genetic algorithms
(GA

s)
[1]
are a cl
ass of
optimization algorithms.
[5]

s attempt to solve
problems through modeling a simplified
version of genetic processes. There are many
problems for which a GA
[5]
approach is

Useful.



Fig: 1

Genetic
algorithms
[
5]
(
GAs
) are adaptive
methods which may be used to solve search
and optimization problems. They are based
on the genetic processes of biological
organisms. Over many generations, natural
populations evolve according to the
principles of natural selection and
"survival
of the fittest. By mimicking this process,
genetic
algorithms
[
5]
are able to "evolve"
solutions to real world problems, if they
have been suitably encoded.

GA

s work with

a
population of

ndividuals
",
each representing a possible solution to a
g
iven problem.

Each individual is assigned a
"fitness score
"
according to how good a

solution to the
problem it is. The highly
-
fit individuals are
given opportunities to "
reproduce
", by
"
cross breeding
" with other individuals in
the population. This produc
es new
individuals as "
offspring
", which share some
features taken from each "
parent
". The least
fit members of the population are less likely
to get selected for reproduction, and so "
die
out
".

4)
G
A
in
C
ryptanalysis
:

International Journal of Mathematics Trends and Technology
-
May to June Issue 2011


-

3

-


The paper begins with covering the
g
enetic algorithm life cycle and the systems
needed to apply a genetic
algorithm
[
5]
. The
systems are considered to be a key

representation, a mating scheme and a
mutation scheme.

In general, the genetic algorithm approach
has only been used to attack fai
rly simple
ciphers. Ciphers attacked include:



Monoalphabetic

Substitution
[6]

cipher



Polyalphabetic

Substitution
[6]

cipher



Permutation cipher



Transposition cipher



Merkle
-
Hellman Knapsack cipher



Chor
-
Rivest Knapsack cipher



Vernam cipher

We

have considered
Mo
noalphabetic
Substitution cipher
for implement
ation.

4.1)
Substitution Cipher:


In
c
ryptography
[8]
, a
substitution
[6]

cipher
is a method of encryption by
which units of plaintext are substituted
with
cipher text
according to a regular
system.




This ciph
er is described
by the
following steps
:

(i)

Let the plaintext ( = the information
which the sender wishes to transmit
to the receiver (s) ) and the
cipher
text
( = encrypted information )
character sets be the same, say the
alphabet Z

(ii)

Let the keys K consist of
all
possible permutations of the
symbols in Z

(iii)

For each permutation p in K:


1. Define the encryption function






x
p
x
ep



2. Define the decryption function






y
p
y
dp
1


, where
1

p
is
the

inverse
permutation to p.

5)
Implementation
:

5.1)


P
roposed Algorithm
:

(i)

Generate a random population of
key strings

(ii)

Determine a fitness value for each
key in the population

(iii)

Do a random selection of parents

(iv)

Apply the crossover
[4]
operation to
the parents

(v)

Apply the
mutation
[4]
process to the
children

(vi)

Scan the new population of key
strings and update the list of the 10
“best” keys seen


5.
2
)
Generate initial population

Com
pute fitness of each individual:

repeat




2
/
pc
n


Where
pc is initial population.



2
,
1
p
p
rand


Where p1, p2 are parent.


)
2
,
1
(
c
c
recombine

Where c1, c2 are child.


offspring
cal



converged
until






n
i
x
i
str
0



(1)

Where
n i
s leng
th of text, x is encrypted
data.

)
(
l
rand
pc

Where
l is 500 to 2013

)
(
j
rand
s

;
Where
j is 1 to 4

International Journal of Mathematics Trends and Technology
-
May to June Issue 2011


-

4

-

to choose the random operations.

R
egarding the addition operation

With
the value
s=1









c
k
c
k
i
str
1
%




(2
)


Where c is constant, c= 26

R
egarding the difference operation

W
ith

the value s
=2









c
k
c
k
i
str
1
%



(3)


R
egarding the multiply operation

With the value s=
3








c
k
c
k
i
str
1
%
*



(4)


Regarding
division operation

With the value s=
1








c
k
c
k
i
str
1
%
/




(5)

Thus
the above equations generate the
initial population.

The next step is the
elimination method.

5.
3
)
Performing Elimination method


Initial population is generated with some
m numbers. Retrieve the parent
s one by one.

)
(
j
rand
z


Where
j is 1 to n


(6)






z
prt
z
str
m





(7)












n
i
z
prt
i
str
i
y
1


(8)







n
i
m
i
y
1




(9)




i
y
differ





(10)

5.
4
)
Evaluating Crossover method





2
/
1
2
,
1
pc
i
p
p
join


(11)


Where p1
, p
2
are the parents.

do the process until
optimized solutions is
reached.

6)
Working Principles


The key representation is an ordered
list of alphabet characters: the first character
in the list is the plaintext chara
cter for the
most frequent
cipher text

character;

t
he
second character is the plaintext character
for the second most frequent
cipher text

character and so on. The mating scheme
randomly selects two keys for mating (keys
with a high fitness value). The two
parent
keys create two child keys by selecting from
each slot in the parents the more frequent
cipher text
character.


The first child key is created by
scanning left to right and the second by
scanning right to left. If the more frequent
character is alr
eady in the child, then the
character from the other parent is selected.
The mutation scheme consists of swapping
two characters in the key string.


The process stops after a fixed
number of generations, at which point, the
best keys are used to decipher
the
cipher
text
.

7)
A
nalysis
:

Typical results:



The exact key is not always found

International Journal of Mathematics Trends and Technology
-
May to June Issue 2011


-

5

-



Visual inspection of the plaintext is
required most of the time to
determine the exact key

Observed cryptanalytic usefulness:



None
-
no exact keys found in
testing

Comment on
result discrepancy:



Different measures of success were
used

8)
Traditional and Modern Methods

8.1
Method
s
in
Cryptanalysis [
7]

The traditional method for the mono

alphabetic
substitution
[
6]
cipher utilizes
frequency analysis and examination.


As a
concl
usion
I would say that the
traditional method is not easily automated
and tends to require a trained and
experienced cryptanalyst. The time needed
to decrypt a text can vary widely. It is not
only the time that makes this method not the
best one to choose
but also the dimension of
the text. It is known that a longer text can be
decrypted easier as the statistical
characteristics are more distinct.


On the other hand the GA
-
based
methods were unsuccessful. Traditional
methods
used to obtain optimal solution

took more time, but were always successful.
Only three of the seven GA
-
based
[
2]

attacks re
-
implemented achieved any
success. The successful attacks were
implemented
on the permutation and
transposition ciphers.

9
)
Conclusion:

We
would say that this is an
equal scored
“game” between traditional and modern
methods. On one hand the traditional “team”
gain a point at this game because their
finality is a successful one. On the other
hand the modern “team” gain their point
because they represent the developmen
t of
technology it depends on us if we can
change the
score!
.


10)
References
:

[1]
Genetic
Algorithms, Melanie
Mitchell

[2]
Foundations of Genetic Algorithms
,

Alden H. Wright, Michael D. Vose,
Kenneth A. De Jong,

[3]
A R
eview On
B
iological
I
nspired

C
omputati
on in CRYPTOLOGY.

[4]
An Improved Cryptanalytic Attack on
Knapsack

Cipher using Genetic Algorithm

Poonam Garg and Aditya Shastri

[5]Srinivas M and Patnaik L.M, ”Genetic
Algorithms: A Survey”,

IEEE Computer,
pp.17
-
26, 1994
.

[6
] Spillman R, Janssen M, Nelson
B and
Kepner M, “Use of

Genetic Algorithm in the
Cryptanalysis of Simple Substitution

Ciphers”, Cryptologia, Vol. 17, No.1, pp.
30
-
44.1993.

[7]
Cryptanalysis and improvement of
Petersen
-
Michels
S
igncryption scheme

W.
-
H. He and T.
-
C. Wu

[8]
Biometric Cryptogr
aphy: Key Generation
Using Feature

and Parametric Aggregation

Christopher Ralph Costanzo

-

14 October
2004
.