Re: logarithm in OpenSSL

2019-07-25 Thread Niklas Niere
The BN_num_bits() approximation is exactly what we need. We need it to compute the depth of a node in a binary tree of which we only have a sub tree available. Thank you, Niklas On 24.07.2019 23:59, Dr Paul Dale wrote: I’m wondering why you need the log function? If you’re measuring performan

Re: logarithm in OpenSSL

2019-07-24 Thread Dr Paul Dale
I’m wondering why you need the log function? If you’re measuring performance, could the analysis tool perform the logarithm? A first order approximation to log_2(n) where n is a BIGNUM would be BN_num_bits(n). Pauli -- Dr Paul Dale | Cryptographer | Network Security & Encryption Phone +61 7 3

Re: logarithm in OpenSSL

2019-07-24 Thread Hal Murray
guidovran...@gmail.com said: > If you require logarithms of large numbers, you'll have to resort to a > library that supports this, like the one I linked to. Or scale the large number so it fits and add the log of the scale factor which you can compute by hand from the scale factor. For examp

Re: logarithm in OpenSSL

2019-07-24 Thread Guido Vranken
log() in math.h only supports float or double type. float and double are limited in the range of numbers they can express. For example, these types cannot hold large numbers like "9". Depending on your purpose, float and double may be sufficient, and you can

Re: logarithm in OpenSSL

2019-07-24 Thread Niklas Niere
Thank you for the answer. We are using the Makefile from OpenSSL to compile our feature as it changes OpenSSL directly. As I understood it, we would have to import another number library to compile our code with the standard OpenSSL settings and using the logarithm, correct? On 2019-07-24 6:51

Re: logarithm in OpenSSL

2019-07-24 Thread Guido Vranken
If you want to use the log() from math.h, then you must compile with -lm, eg.: clang source.c -lm The log() in math.h only supports floating point numbers. If you require computing logarithms of bignums, try https://www.mpfr.org/ On Wed, Jul 24, 2019 at 6:39 PM Niklas Niere wrote: > Hello, > >