|
|
@ -6,7 +6,7 @@ |
|
|
|
#include <cybozu/crypto.hpp> |
|
|
|
#include <cybozu/crypto.hpp> |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#include <cybozu/endian.hpp> |
|
|
|
#include <cybozu/endian.hpp> |
|
|
|
#include "conversion.hpp" |
|
|
|
#include <mcl/conversion.hpp> |
|
|
|
#ifdef MCL_USE_XBYAK |
|
|
|
#ifdef MCL_USE_XBYAK |
|
|
|
#include "fp_generator.hpp" |
|
|
|
#include "fp_generator.hpp" |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -575,23 +575,6 @@ bool Op::init(const char *str, size_t maxBitSize, Mode mode, size_t mclMaxBitSiz |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
size_t arrayToStr(char *buf, size_t bufSize, const Unit *x, size_t n, int ioMode) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
int base = ioMode & ~IoPrefix; |
|
|
|
|
|
|
|
bool withPrefix = (ioMode & IoPrefix) != 0; |
|
|
|
|
|
|
|
switch (base) { |
|
|
|
|
|
|
|
case 0: |
|
|
|
|
|
|
|
case 10: |
|
|
|
|
|
|
|
return mcl::fp::arrayToDec(buf, bufSize, x, n); |
|
|
|
|
|
|
|
case 16: |
|
|
|
|
|
|
|
return mcl::fp::arrayToHex(buf, bufSize, x, n, withPrefix); |
|
|
|
|
|
|
|
case 2: |
|
|
|
|
|
|
|
return mcl::fp::arrayToBin(buf, bufSize, x, n, withPrefix); |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void copyUnitToByteAsLE(uint8_t *dst, const Unit *src, size_t byteSize) |
|
|
|
void copyUnitToByteAsLE(uint8_t *dst, const Unit *src, size_t byteSize) |
|
|
|
{ |
|
|
|
{ |
|
|
|
while (byteSize >= sizeof(Unit)) { |
|
|
|
while (byteSize >= sizeof(Unit)) { |
|
|
|