diff --git a/src/ringct/multiexp.cc b/src/ringct/multiexp.cc index 51b31ed71..693170d7d 100644 --- a/src/ringct/multiexp.cc +++ b/src/ringct/multiexp.cc @@ -154,77 +154,6 @@ static inline void add(ge_p3 &p3, const ge_p3 &other) add(p3, cached); } -rct::key bos_coster_heap_conv(std::vector data) -{ - MULTIEXP_PERF(PERF_TIMER_START_UNIT(bos_coster, 1000000)); - MULTIEXP_PERF(PERF_TIMER_START_UNIT(setup, 1000000)); - size_t points = data.size(); - CHECK_AND_ASSERT_THROW_MES(points > 1, "Not enough points"); - std::vector heap(points); - for (size_t n = 0; n < points; ++n) - heap[n] = n; - - auto Comp = [&](size_t e0, size_t e1) { return data[e0].scalar < data[e1].scalar; }; - std::make_heap(heap.begin(), heap.end(), Comp); - MULTIEXP_PERF(PERF_TIMER_STOP(setup)); - - MULTIEXP_PERF(PERF_TIMER_START_UNIT(loop, 1000000)); - MULTIEXP_PERF(PERF_TIMER_START_UNIT(pop, 1000000)); MULTIEXP_PERF(PERF_TIMER_PAUSE(pop)); - MULTIEXP_PERF(PERF_TIMER_START_UNIT(add, 1000000)); MULTIEXP_PERF(PERF_TIMER_PAUSE(add)); - MULTIEXP_PERF(PERF_TIMER_START_UNIT(sub, 1000000)); MULTIEXP_PERF(PERF_TIMER_PAUSE(sub)); - MULTIEXP_PERF(PERF_TIMER_START_UNIT(push, 1000000)); MULTIEXP_PERF(PERF_TIMER_PAUSE(push)); - while (heap.size() > 1) - { - MULTIEXP_PERF(PERF_TIMER_RESUME(pop)); - std::pop_heap(heap.begin(), heap.end(), Comp); - size_t index1 = heap.back(); - heap.pop_back(); - std::pop_heap(heap.begin(), heap.end(), Comp); - size_t index2 = heap.back(); - heap.pop_back(); - MULTIEXP_PERF(PERF_TIMER_PAUSE(pop)); - - MULTIEXP_PERF(PERF_TIMER_RESUME(add)); - ge_cached cached; - ge_p3_to_cached(&cached, &data[index1].point); - ge_p1p1 p1; - ge_add(&p1, &data[index2].point, &cached); - ge_p1p1_to_p3(&data[index2].point, &p1); - MULTIEXP_PERF(PERF_TIMER_PAUSE(add)); - - MULTIEXP_PERF(PERF_TIMER_RESUME(sub)); - sc_sub(data[index1].scalar.bytes, data[index1].scalar.bytes, data[index2].scalar.bytes); - MULTIEXP_PERF(PERF_TIMER_PAUSE(sub)); - - MULTIEXP_PERF(PERF_TIMER_RESUME(push)); - if (!(data[index1].scalar == rct::zero())) - { - heap.push_back(index1); - std::push_heap(heap.begin(), heap.end(), Comp); - } - - heap.push_back(index2); - std::push_heap(heap.begin(), heap.end(), Comp); - MULTIEXP_PERF(PERF_TIMER_PAUSE(push)); - } - MULTIEXP_PERF(PERF_TIMER_STOP(push)); - MULTIEXP_PERF(PERF_TIMER_STOP(sub)); - MULTIEXP_PERF(PERF_TIMER_STOP(add)); - MULTIEXP_PERF(PERF_TIMER_STOP(pop)); - MULTIEXP_PERF(PERF_TIMER_STOP(loop)); - - MULTIEXP_PERF(PERF_TIMER_START_UNIT(end, 1000000)); - //return rct::scalarmultKey(data[index1].point, data[index1].scalar); - std::pop_heap(heap.begin(), heap.end(), Comp); - size_t index1 = heap.back(); - heap.pop_back(); - ge_p2 p2; - ge_scalarmult(&p2, data[index1].scalar.bytes, &data[index1].point); - rct::key res; - ge_tobytes(res.bytes, &p2); - return res; -} - rct::key bos_coster_heap_conv_robust(std::vector data) { MULTIEXP_PERF(PERF_TIMER_START_UNIT(bos_coster, 1000000)); diff --git a/src/ringct/multiexp.h b/src/ringct/multiexp.h index bf76eb72e..d85c589de 100644 --- a/src/ringct/multiexp.h +++ b/src/ringct/multiexp.h @@ -62,7 +62,6 @@ struct MultiexpData { struct straus_cached_data; using pippenger_cached_data = std::vector>; -rct::key bos_coster_heap_conv(std::vector data); rct::key bos_coster_heap_conv_robust(std::vector data); std::shared_ptr straus_init_cache(const std::vector &data, size_t N =0); size_t straus_get_cache_size(const std::shared_ptr &cache); diff --git a/src/ringct/rctOps.cpp b/src/ringct/rctOps.cpp index 8a9c76e82..dcfb8342f 100644 --- a/src/ringct/rctOps.cpp +++ b/src/ringct/rctOps.cpp @@ -633,19 +633,6 @@ namespace rct { return hash; } - //cn_fast_hash for a 128 byte unsigned char - key cn_fast_hash128(const void * in) { - key hash; - keccak((const uint8_t *)in, 128, hash.bytes, 32); - return hash; - } - - key hash_to_scalar128(const void * in) { - key hash = cn_fast_hash128(in); - sc_reduce32(hash.bytes); - return hash; - } - //cn_fast_hash for multisig purpose //This takes the outputs and commitments //and hashes them into a 32 byte sized key @@ -703,15 +690,6 @@ namespace rct { ge_p1p1_to_p3(&hash8_p3, &hash8_p1p1); } - //sums a vector of curve points (for scalars use sc_add) - void sumKeys(key & Csum, const keyV & Cis) { - identity(Csum); - size_t i = 0; - for (i = 0; i < Cis.size(); i++) { - addKeys(Csum, Csum, Cis[i]); - } - } - //Elliptic Curve Diffie-Hellman: encodes and decodes the amount b and mask a // where C= aG + bH key genAmountEncodingFactor(const key &k) diff --git a/src/ringct/rctOps.h b/src/ringct/rctOps.h index e7db2f5be..a374e1a82 100644 --- a/src/ringct/rctOps.h +++ b/src/ringct/rctOps.h @@ -64,7 +64,6 @@ namespace rct { inline void identity(key &Id) { memcpy(&Id, &I, 32); } //Creates a key equal to the curve order inline key curveOrder() { return L; } - inline void curveOrder(key &l) { l = L; } //copies a scalar or point inline void copy(key &AA, const key &A) { memcpy(&AA, &A, 32); } inline key copy(const key & A) { key AA; memcpy(&AA, &A, 32); return AA; } @@ -156,8 +155,6 @@ namespace rct { key cn_fast_hash(const key &in); key hash_to_scalar(const key &in); //for mg sigs - key cn_fast_hash128(const void * in); - key hash_to_scalar128(const void * in); key cn_fast_hash(const ctkeyV &PC); key hash_to_scalar(const ctkeyV &PC); //for mg sigs @@ -169,8 +166,6 @@ namespace rct { void hash_to_p3(ge_p3 &hash8_p3, const key &k); - //sums a vector of curve points (for scalars use sc_add) - void sumKeys(key & Csum, const key &Cis); //Elliptic Curve Diffie-Hellman: encodes and decodes the amount b and mask a // where C= aG + bH diff --git a/src/ringct/rctTypes.cpp b/src/ringct/rctTypes.cpp index 51260c079..24c86700f 100644 --- a/src/ringct/rctTypes.cpp +++ b/src/ringct/rctTypes.cpp @@ -154,34 +154,6 @@ namespace rct { return true; } - //32 byte key to int[64] - void h2b(bits amountb2, const key & test) { - int val = 0, i = 0, j = 0; - for (j = 0; j < 8; j++) { - val = (unsigned char)test.bytes[j]; - i = 0; - while (i < 8) { - amountb2[j*8+i++] = val & 1; - val >>= 1; - } - } - } - - //int[64] to 32 byte key - void b2h(key & amountdh, const bits amountb2) { - int byte, i, j; - for (j = 0; j < 8; j++) { - byte = 0; - for (i = 7; i > -1; i--) { - byte = byte * 2 + amountb2[8 * j + i]; - } - amountdh[j] = (unsigned char)byte; - } - for (j = 8; j < 32; j++) { - amountdh[j] = (unsigned char)(0x00); - } - } - //int[64] to uint long long xmr_amount b2d(bits amountb) { xmr_amount vali = 0; diff --git a/src/ringct/rctTypes.h b/src/ringct/rctTypes.h index 608aa5bfd..17f6a61e6 100644 --- a/src/ringct/rctTypes.h +++ b/src/ringct/rctTypes.h @@ -724,10 +724,6 @@ namespace rct { // if the key holds a value > 2^64 // then false is returned bool h2d(xmr_amount &amountd, const key &test); - //32 byte key to int[64] - void h2b(bits amountb2, const key & test); - //int[64] to 32 byte key - void b2h(key & amountdh, bits amountb2); //int[64] to uint long long xmr_amount b2d(bits amountb);