Browse Source

bugfix FieldElem::SetHex

master
Pieter Wuille 10 years ago
parent
commit
cd31bf9ad2
  1. 2
      field.h
  2. 2
      tests.cpp

2
field.h

@ -373,7 +373,7 @@ public: @@ -373,7 +373,7 @@ public:
0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0};
for (int i=0; i<32; i++) {
if (str.length() > i*2)
tmp[i] = (cvt[(unsigned char)str[2*i]] << 4) + cvt[(unsigned char)str[2*i+1]];
tmp[32 - str.length()/2 + i] = (cvt[(unsigned char)str[2*i]] << 4) + cvt[(unsigned char)str[2*i+1]];
}
SetBytes(tmp);
}

2
tests.cpp

@ -62,7 +62,7 @@ void test_point_times_order(const GroupElemJac &point) { @@ -62,7 +62,7 @@ void test_point_times_order(const GroupElemJac &point) {
void test_run_point_times_order() {
Context ctx;
FieldElem x; x.SetHex("0000000000000000000000000000000000000000000000000000000000000002");
FieldElem x; x.SetHex("02");
for (int i=0; i<500; i++) {
GroupElemJac j; j.SetCompressed(x, true);
test_point_times_order(j);

Loading…
Cancel
Save