How can i implement galois counter mode (GCM) in matlab?

1 次查看(过去 30 天)
The image above shows an algorithm to find the multiplication of 2 blocks using galois field.I tried implementing it,but got an error.Can somebody help me??
clc;
clear all;
close all;
x=01101101;
Z=00000000;
v=11001011;
for i=0:1:8
if x(i)== 0
Z(i+1)= Zi;
else xi == 1
Z(i+1)= xor(Zi,Vi);
end
end
The error was: Subscript indices must either be real positive integers or logicals.
Error in algo1 (line 8) if x(i)== 0

采纳的回答

Ahmed Grera
Ahmed Grera 2017-9-18
编辑:Ahmed Grera 2017-9-18
Hi Darsana P M
You can retype it like this:
clc;
clear all;
close all;
x=[0 1 1 0 1 1 0 1];
Z=[0 0 0 0 0 0 0 0];
v=[1 1 0 0 1 0 1 1];
for i=1:1:8 %-----or use i=1:8------
if x(i)== 0
Z(i+1)= Z(i);
else x(i) == 1;
Z(i+1)= xor(Z(i),v(i));
end
end
Z
Greetings Eng. Ahmed G
Good luck
  4 个评论
Ahmed Grera
Ahmed Grera 2017-9-18
Hi Darsana P M
Following the answer I have just posted to your question.
Would you please be so kind to have a look and if it helps, would you please consider marking my answer as accepted answer by clicking on the Accepted Answer? thanks in advance, awaiting
Zeeshan Abbas
Zeeshan Abbas 2019-6-19
Is it showing (nonce+counter) XOR (key)??
let say: x=nonce
v=key
z = output?
Am i right?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Error Detection and Correction 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by