addition of points in a curve

3 ビュー (過去 30 日間)
amina amzgh
amina amzgh 2020 年 7 月 29 日
コメント済み: amina amzgh 2020 年 7 月 30 日
I made a function which calculates the addition of two points in a curve, in my main program I want to calculate "kG = G + G + G + .... k times" knowing that k is a random number, example: G + G = r1 r1 + G = r2 r3 + G = r3 ... ect up to "rk" could someone help me calculate kG using my addition function
  5 件のコメント
Bruno Luong
Bruno Luong 2020 年 7 月 30 日
Vous n'auriez pas dû regarder au bon endroit, j'utilise une fonction qui fait l'addition de 2 points. Chez moi elle s'appelle EL_add. Elle fait plus que le dédoublement de point. C'est elle que vous devriez remplacer par votre fonction (et les petit détails entre le codage de votre courbe et la mienne). Si vous faites tourner le code vous obtiendriez le tableau de 1*G, 2*G, ..., maxC*G. Donc définissez maxC comme le "k" chez vous, faites tourner le code kG et dans le dernier point du tableau.
EL = struct('a', 148, 'b', 225, 'p', 5003);
% Point
G = [1355,2421];
% Compute C*G for C=1,2,...,maxC
maxC = 5003;
maxk = nextpow2(maxC);
CG = zeros(maxC,2);
j = 1;
CG(j,:) = G;
G2k = G;
% precompute the inverse of 1...p-1, and stores in table itab
p = EL.p;
itab = p_inverse(1:p-1, p);
for k=1:maxk
for i=1:j-1
j = j+1;
CG(j,:) = EL_add(G2k,CG(i,:),EL,itab); % <- REMPLACEZ PAR VOTRE FONCTION
if j == maxC
break
end
end
if j == maxC
break
end
G2k = EL_add(G2k,G2k,EL,itab);
j = j+1;
CG(j,:) = G2k;
end
CG
% etc...
amina amzgh
amina amzgh 2020 年 7 月 30 日
ça ne marche toujours pas malheureusement

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeLanguage Fundamentals についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by