Bonjour,
Je fait un petit programme cryptant par courbe elliptique. Dans celui-ci je dois impl�menter l'exponentiation rapide. C'est un algo simple mais j'ai r�ussi � me planter et je ne vois pas o�...
La fonction AddPoints() fonctionne (v�rifi�), voici son prototye:
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13 template<typename T> std::pair<T, T> QuickExponentiation(T p, T a, T e, std::pair<T, T> point) { if( 1 < e) { if(p % 2 ==0) return AddPoints(p, a, QuickExponentiation(p, a, e/2, point), QuickExponentiation(p, a, e/2,point)); else return AddPoints(p, a, AddPoints(p, a, QuickExponentiation(p, a, (e-1)/2,point), QuickExponentiation(p, a, (e-1)/2, point)), point); } return point; }
template<typename T>
std::pair< T, T> AddPoints(T p, T a, const std::pair<T, T>& firstPoint, const std::pair<T, T>& secondPoint);
Votre aide est la bienvenue.
Merci
Partager