0% found this document useful (0 votes)
24 views

2017-CE-008 Lab 11

Uploaded by

kamran khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

2017-CE-008 Lab 11

Uploaded by

kamran khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

LAB # 11 DIGITAL SIGNATURE STANDARD (DSS) SSUET/QR/112

LAB # 11
DIGITAL SIGNATURE STANDARD (DSS)

Objective: Write a code of DSS Algorithm for q= 24 and i= 4.


CODE:
clc OUTPUT:
clear all
q = 23;
p = (q*2) + 1;
i = 8; y=
while ~isprime(p)
p = (q*i) + 1;
i = i + 1; 37
end
g = 2;
H_M = 2; r=
% Public Key Computation
x = 10; % Selecting x = 10, the public key is
y = mod(g^x, p) % Signature Pair Computation 4
k = 2; % Selecting k = 2, the signature pair is
r = mod(mod(g^k, p), q)
k_inv = 1; s=
while ~(mod(k*k_inv, q) == 1)
k_inv = k_inv + 1;
end 21
s = mod(k_inv*(H_M + (x * r)), q) % Verify
Signatures
s_inv = 1;
v1 =
while ~(mod(s*s_inv, q) == 1)
s_inv = s_inv + 1;
end 4
w = mod(s_inv, q);
u1 = mod(H_M*w, q);
u2 = mod(r*w, q); % Using Power breaking method
u1_fact = factor(u1);
v2 =
gu1 = 1; for i = u1_fact
gu1 = mod(gu1 * g^(i), q); 18
end
u2_fact = factor(u2);
yu2 = 1;
for i = u2_fact v=
yu2 = mod(yu2 * y^(i), q);
end 4
v1 = mod(gu1, q)
v2 = mod(yu2, q)
v = mod(v1*v2, q)+1
Verified
if r == v
disp('Verified')
else
disp('Error')
end

CE-408: Cryptography & Network Security

You might also like