From cd31bf9ad2c8ebda63095e9a8180ed4c216b10aa Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Mon, 11 Mar 2013 01:35:46 +0100 Subject: [PATCH] bugfix FieldElem::SetHex --- field.h | 2 +- tests.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/field.h b/field.h index 2d0dec532d5..c7f510e6d98 100644 --- a/field.h +++ b/field.h @@ -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); } diff --git a/tests.cpp b/tests.cpp index 742b532448b..4981432f002 100644 --- a/tests.cpp +++ b/tests.cpp @@ -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);