Cryptography and Applications (CSCT6104)
Computer Science - COS
Semester: First Semester
Level: 500
Year: 2018
1
REPUBLIC OF CAMEROON THE UNIVERSITY OF BAMENDA
Peace-Work-Fatherland P.O. Box 39 Bambili
2018-2019 First Semester Examinations
School: HTTTC Department: Computer Science Option: FCS Year: 5
Course Code: CSCT6104 Course Title: Cryptography and applications
Lecturer: Dr. DADA Jean-Pierre Credit Value: 3
Date: Time: 1:30 hour Start Time: End Time:
Exercise 1:
A
5x5-squ
a
r
e mat
r
i
x
c
on
tai
n
i
ng
t
h
e
26
lette
rs
of
t
h
e al
ph
a
b
et
(I
a
nd
J
a
r
e t
r
eate
d
a
s
t
h
e
s
ame
lette
r)
i
s
us
e
d
t
o
ca
rry
ou
t t
h
e e
n
c
ryp
ti
on.
A
k
e
y
word,
C
OMP
U
TE
R
i
n
t
h
i
s
e
x
am
p
le
,
i
s
f
ille
d
i
n
f
i
rs
t
,
a
nd
t
h
e
r
emai
n
i
ng
unus
e
d
lette
rs
of
t
h
e al
ph
a
b
et a
r
e e
n
te
r
e
d
i
n
t
h
ei
r
le
x
ic
ogr
a
ph
ic
ord
e
r
:
1)
What type of encryption is this?
2)
Complete the above table
3) List all the 4 rules to encrypt any word using this type of encryption
4) Write an appropriate algorithm for this encryption
5) Write an appropriate C program for this encryption
Exercise 2:
Let us assign values to the alphabet as shown in the table below:
A B C D E F G H I J K L M
0 1 2 3 4 5 6 7 8 9 10 11 12
N O P Q R S T U V W X Y Z
13 14 15 16 17 18 19 20 21 22 23 24 25
Let
𝑎
and
𝑏
being integers, the affine hash function for encryption and decryption is defined as:
ℤ
𝑛
− −→ ℤ
𝑛
Y=f(x)--->(ax+b)modn
1) Give the expression of the hash function for decryption in terms of a, x and b
2) Apply the affine hash function y=f(x)=(3x+5)mod26 to encrypt the expression:
WE ARE WRITING EXAM.
3) Give the expression of the affine hash function for decryption
4)
Write an algorithm for affine cipher for encryption
5)
A hash function for decryption has as expression y=(9x+7). Apply this function to decrypt the word:
PF LVPYNKRE
Exercise 3: Here is a program
#include <stdio.h>
#include <math.h>
int main(int argc, char *argv[]) {
int a,b,r,x,aa,bb;
printf("Enter two positive numbers\n");
scanf("%i %i",&a,&b);
aa=a;
www.schoolfaqs.net
2
bb=b;
if (a<b) {
r=a;
a=b;
b=r;
}
do {
printf("#################################\n");
r=a%b;
a=b;
b=r;
printf("r= %i \n",r);
printf("b= %i \n",b);
printf("a= %i \n",a);
} while(r!=0);
printf("#################################\n");
printf("The GCD(%i,%i)=%i \n",aa,bb,a);
printf("#################################\n");
printf("THANKS\n");
system("PAUSE");
return 0;
1. What language is this program?
2. What software has been used type this program?
3. Execute manually the program and draw up the screen as the user will observe when running this
program. Do not forget to draw the RAM with its contents related for this program as it is running
(Only the last state is requested).
www.schoolfaqs.net