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ù ...
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;
    }
La fonction AddPoints() fonctionne (vérifié), voici son prototye:
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