You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bitcoin/secp256k1.cpp

41 lines
1.2 KiB

12 years ago
#include <stdio.h>
12 years ago
#include "num.h"
#include "field.h"
#include "group.h"
12 years ago
#include "ecmult.h"
12 years ago
#include "ecdsa.h"
12 years ago
using namespace secp256k1;
int main() {
Context ctx;
12 years ago
FieldElem x,y;
12 years ago
const Number &order = GetGroupConst().order;
12 years ago
x.SetHex("8b30bbe9ae2a990696b22f670709dff3727fd8bc04d3362c6c7bf458e2846004");
y.SetHex("a357ae915c4a65281309edf20504740f0eb3343990216b4f81063cb65f2f7e0f");
GroupElemJac a(x,y);
printf("a=%s\n", a.ToString().c_str());
12 years ago
Number an(ctx);
12 years ago
an.SetHex("8b30bce9ad2a890696b23f671709eff3727fd8cc04d3362c6c7bf458f2846fff");
12 years ago
Number af(ctx);
12 years ago
af.SetHex("1337");
printf("an=%s\n", an.ToString().c_str());
12 years ago
Number gn(ctx);
12 years ago
gn.SetHex("f557be925d4b65381409fdf30514750f1eb4343a91216a4f71163cb35f2f6e0e");
12 years ago
Number gf(ctx);
gf.SetHex("7113");
12 years ago
printf("gn=%s\n", gn.ToString().c_str());
12 years ago
for (int i=0; i<1000000; i++) {
12 years ago
ECMult(ctx, a, a, an, gn);
12 years ago
// an.SetModMul(ctx, af, order);
// gn.SetModMul(ctx, gf, order);
an.Inc();
gn.Inc();
12 years ago
}
12 years ago
printf("%s\n", an.ToString().c_str());
printf("%s\n", gn.ToString().c_str());
12 years ago
printf("%s\n", a.ToString().c_str());
12 years ago
return 0;
}