begin ECDSA

This commit is contained in:
Pieter Wuille
2013-03-10 05:34:04 +01:00
parent 949bea9262
commit 83e640f0ba
4 changed files with 91 additions and 3 deletions

26
group.h
View File

@@ -39,6 +39,14 @@ public:
y.SetNeg(y, 1);
}
void GetX(FieldElem &xout) const {
xout = x;
}
void GetY(FieldElem &yout) const {
yout = y;
}
std::string ToString() const {
if (fInfinity)
return "(inf)";
@@ -101,6 +109,24 @@ public:
aff.y = y;
}
void GetX(FieldElem &xout) {
FieldElem zi;
zi.SetInverse(z);
zi.SetSquare(zi);
xout.SetMult(x, zi);
}
bool IsInfinity() const {
return fInfinity;
}
void GetY(FieldElem &yout) {
FieldElem zi;
zi.SetInverse(z);
FieldElem zi3; zi3.SetSquare(zi); zi3.SetMult(zi, zi3);
yout.SetMult(y, zi3);
}
void SetNeg(const GroupElemJac &p) {
*this = p;
y.Normalize();