Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Priti-Kaushik authored Jan 14, 2018
1 parent a1e0942 commit bdc9dbc
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 0 deletions.
47 changes: 47 additions & 0 deletions Comparison_Pi4.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
clc
load('HMAC_onPj_atPi.mat');
load('HMAC_onPj_atPj.mat');
load('concatenated12bit_Pi.mat');
C = false(30,160);
Com = false(30,160);
CwithPi = false(30,12);
Key_Pi = false(30,12);
For_zero = false(1,160);
Another_zero = false(1,12);
concatenated12bit_Pi = concatenated12bit_Pi== '1';

for i = 1:30
for j = 1:30
if HMAC_onPj_atPi(i,:) == HMAC_onPj_atPj(j,:)
HMAC_onPj_atPj(j,:)
C(i,:) = HMAC_onPj_atPj(j,:);
end
end
end

for i = 1:30
for j = 1:30
if HMAC_onPj_atPj(i,:) == HMAC_onPj_atPi(j,:)
Com(i,:) = HMAC_onPj_atPi(j,:);
end
end
end

for i = 1:30
if C(i,:) == For_zero
CwithPi(i,:) = Another_zero;
else
CwithPi(i,:) = concatenated12bit_Pi(i,:);
end
end

for i = 1:30
for j = 1:30
if C(i,:) == Com(j,:)
Key_Pi(i,:) = CwithPi(i,:);

end
end
end
%Key_Pi = Key_Pi(randperm(end));
save('Key_Pi.mat','Key_Pi');
19 changes: 19 additions & 0 deletions Comparison_Pj4.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
clc
load('HMAC_onPi_atPi.mat');
load('HMAC_onPi_atPj.mat');
load('concatenated12bit_Pj.mat');
concatenated12bit_Pj = concatenated12bit_Pj== '1';
Key_Pj = false(30,12);
Another_zero_Pj = false(1,12);
for i = 1:30
for j = 1:30
if HMAC_onPi_atPi(i,:) == HMAC_onPi_atPj(j,:)
Key_Pj(i,:) = concatenated12bit_Pj(j,:);

% else
% Key_Pj(i,:) = Another_zero;
end
end
end
%Key_Pj = Key_Pj(randperm(end));
save('Key_Pj.mat','Key_Pj');
18 changes: 18 additions & 0 deletions add_Pi3.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
tic
% @Node Pi
load('String_Pi.mat');
load('String_Pj.mat');
load('FV_Pi.mat');
%hash1_Pi = zeros(30,1,'int8');
for n = 1:30
hash1_Pi(n,:) = HMAC(FV_Pi(n,:),String_Pi,'SHA-1'); % HMAC_String_Pi

hash2_Pi(n,:) = HMAC(FV_Pi(n,:),String_Pj,'SHA-1'); % HMAC_String_Pj
end
%Table_Pi = table(FV_Pi, hash1_Pi)
HMAC_onPi_atPi = hexToBinaryVector(hash1_Pi);
HMAC_onPj_atPi = hexToBinaryVector(hash2_Pi);
HMAC_onPj_atPi(2,:)
save('HMAC_onPj_atPi.mat','HMAC_onPj_atPi');
save('HMAC_onPi_atPi.mat','HMAC_onPi_atPi');
toc
17 changes: 17 additions & 0 deletions add_Pj3.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
tic
% @Node Pi
load('String_Pi.mat');
load('String_Pj.mat');
load('concatenated12bit_Pj.mat');
load('FV_Pj.mat');
concatenated12bit_Pj
for n = 1:30
hash1_Pj(n,:) = HMAC(FV_Pj(n,:),String_Pi,'SHA-1'); % HMAC_String_Pi
hash2_Pj(n,:) = HMAC(FV_Pj(n,:),String_Pj,'SHA-1'); % HMAC_String_Pj
end
HMAC_onPi_atPj = hexToBinaryVector(hash1_Pj);
Table_Pj = table(concatenated12bit_Pj, HMAC_onPi_atPj)
HMAC_onPj_atPj = hexToBinaryVector(hash2_Pj);
save('HMAC_onPj_atPj.mat','HMAC_onPj_atPj');
save('HMAC_onPi_atPj.mat','HMAC_onPi_atPj');
toc

0 comments on commit bdc9dbc

Please sign in to comment.