2019-12-04 21:37:24 +01:00
|
|
|
#ifndef ELLIGATOR_H__
|
|
|
|
#define ELLIGATOR_H__
|
|
|
|
|
2019-12-05 22:03:11 +01:00
|
|
|
#include <inttypes.h>
|
2019-12-04 21:37:24 +01:00
|
|
|
#include <memory>
|
2019-12-05 22:03:11 +01:00
|
|
|
#include <openssl/bn.h>
|
2019-12-04 21:37:24 +01:00
|
|
|
|
|
|
|
namespace i2p
|
|
|
|
{
|
|
|
|
namespace crypto
|
|
|
|
{
|
|
|
|
|
|
|
|
class Elligator2
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Elligator2 ();
|
|
|
|
~Elligator2 ();
|
2019-12-05 22:03:11 +01:00
|
|
|
|
|
|
|
void Encode (const uint8_t * key, uint8_t * encoded) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2019-12-06 20:54:15 +01:00
|
|
|
BIGNUM * p, * n1, * n2, * p38, * p12, * sqrtn1, * A, * nA, * u, * iu, * d;
|
2019-12-04 21:37:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
std::unique_ptr<Elligator2>& GetElligator ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|