37 if (!get()->m_execs.count(_name))
38 BOOST_THROW_EXCEPTION(ExecutorNotFound());
39 return get()->m_execs[_name];
44 if (!get()->m_pricers.count(_name))
45 BOOST_THROW_EXCEPTION(PricerNotFound());
46 return get()->m_pricers[_name];
62 memcpy(&in, _in.data(), min(_in.size(),
sizeof(in)));
66 if (v >= 27 && v <= 28)
76 memset(ret.
data(), 0, 12);
98 return {
true, _in.toBytes()};
105 if (_begin > _in.
count())
107 assert(_count <= numeric_limits<size_t>::max() / 8);
109 size_t const begin{_begin};
110 size_t const count{_count};
115 bigint ret = fromBigEndian<bigint>(cropped);
117 assert(count - cropped.
count() <= numeric_limits<size_t>::max() / 8);
118 ret <<= 8 * (count - cropped.
count());
125 bigint const baseLength(parseBigEndianRightPadded(_in, 0, 32));
126 bigint const expLength(parseBigEndianRightPadded(_in, 32, 32));
127 bigint const modLength(parseBigEndianRightPadded(_in, 64, 32));
128 assert(modLength <= numeric_limits<size_t>::max() / 8);
129 assert(baseLength <= numeric_limits<size_t>::max() / 8);
130 if (modLength == 0 && baseLength == 0)
131 return {
true,
bytes{}};
132 assert(expLength <= numeric_limits<size_t>::max() / 8);
134 bigint const base(parseBigEndianRightPadded(_in, 96, baseLength));
135 bigint const exp(parseBigEndianRightPadded(_in, 96 + baseLength, expLength));
136 bigint const mod(parseBigEndianRightPadded(_in, 96 + baseLength + expLength, modLength));
138 bigint const result = mod != 0 ? boost::multiprecision::powm(base, exp, mod) :
bigint{0};
140 size_t const retLength(modLength);
141 bytes ret(retLength);
151 if (_expLength <= 32)
153 bigint const exp(parseBigEndianRightPadded(_in, _expOffset, _expLength));
154 return exp ? msb(exp) : 0;
158 bigint const expFirstWord(parseBigEndianRightPadded(_in, _expOffset, 32));
159 size_t const highestBit(expFirstWord ? msb(expFirstWord) : 0);
160 return 8 * (_expLength - 32) + highestBit;
169 return (_x * _x) / 4 + 96 * _x - 3072;
171 return (_x * _x) / 16 + 480 * _x - 199680;
177 bigint const baseLength(parseBigEndianRightPadded(_in, 0, 32));
178 bigint const expLength(parseBigEndianRightPadded(_in, 32, 32));
179 bigint const modLength(parseBigEndianRightPadded(_in, 64, 32));
181 bigint const maxLength(max(modLength, baseLength));
182 bigint const adjustedExpLength(expLengthAdjust(baseLength + 96, expLength, _in));
184 return multComplexity(maxLength) * max<bigint>(adjustedExpLength, 1) / 20;
204 return 100000 + (_in.
size() / 192) * 80000;