I want to double all the points on the elliptic curves in matlab

2 ビュー (過去 30 日間)
sadiqa ilyas
sadiqa ilyas 2019 年 7 月 17 日
編集済み: Bruno Luong 2019 年 7 月 17 日
I want to double all the points on the elliptic curves .I have written a code but it gives error. Matrix A contains few points but this code dosnot work.
%curve equation is y^2=x^3+17 mod 313
A=[[199 29] [200 26] [202 14] [203 110] [209 102]];
for i=1:5
B=multell(A(i),2,0,17,313);
end
B
  1 件のコメント
Bruno Luong
Bruno Luong 2019 年 7 月 17 日
編集済み: Bruno Luong 2019 年 7 月 17 日
You have issue with construction and indexing of your A matrix.
Please revise MATLAB syntax and array indexing.

サインインしてコメントする。

採用された回答

Bruno Luong
Bruno Luong 2019 年 7 月 17 日
編集済み: Bruno Luong 2019 年 7 月 17 日
See this post there a an algo to demonstrate doubling and adding points in EC.
Adapt for your case
% EL parameters
a = 0;
b = 17;
% Group Z/pZ parameter
p = 313;
A=[[199 29]; [200 26]; [202 14]; [203 110]; [209 102]]
B = zeros(size(A));
% Point
for k=1:size(A,1)
G = A(k,:);
% Compute G2 = 2*G
x = G(1);
y = G(2);
d = mod(2*y,p);
[~,invd,~] = gcd(d,p);
n = mod(3*x*x + a,p);
lambda = mod(n*invd,p);
x2 = mod(lambda*lambda - 2*x,p);
y2 = mod(lambda*(x-x2)-y,p);
G2 = [x2 y2];
B(k,:) = G2;
end
B
  2 件のコメント
sadiqa ilyas
sadiqa ilyas 2019 年 7 月 17 日
i want to double all the points in matrix A at a time.
sadiqa ilyas
sadiqa ilyas 2019 年 7 月 17 日
It works. Thanks a lot

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by