mirror of
https://github.com/monero-project/monero.git
synced 2026-07-28 14:47:15 -07:00
ringct: remove dead code
- h2b, b2h (rctTypes) and sumKeys (rctOps): from the original RingCT import (9b1afe5f2, 2016-05-13); never referenced by any caller since the import. - cn_fast_hash128, hash_to_scalar128 (rctOps): from the same import. hash_to_scalar128 (and cn_fast_hash128 through it) was last used by the original MLSAG gen/ver hashing, whichdbb5f2d6a(2016-07-09) replaced with keyV-based hash_to_scalar; dead since then. - bos_coster_heap_conv (multiexp): added in9ff6e6a0a(2018-01-09) alongside bos_coster_heap_conv_robust; multiexp() only ever dispatched the robust variant, so the non-robust one was never called. The robust variant is kept, as tests/performance_tests still uses it (production dispatch moved to Straus/Pippenger in 939bc22/263431c).
This commit is contained in:
@@ -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<MultiexpData> 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<size_t> 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<MultiexpData> data)
|
||||
{
|
||||
MULTIEXP_PERF(PERF_TIMER_START_UNIT(bos_coster, 1000000));
|
||||
|
||||
@@ -62,7 +62,6 @@ struct MultiexpData {
|
||||
struct straus_cached_data;
|
||||
using pippenger_cached_data = std::vector<ge_cached, boost::alignment::aligned_allocator<ge_cached, 4096>>;
|
||||
|
||||
rct::key bos_coster_heap_conv(std::vector<MultiexpData> data);
|
||||
rct::key bos_coster_heap_conv_robust(std::vector<MultiexpData> data);
|
||||
std::shared_ptr<straus_cached_data> straus_init_cache(const std::vector<MultiexpData> &data, size_t N =0);
|
||||
size_t straus_get_cache_size(const std::shared_ptr<straus_cached_data> &cache);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user