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:
|
|
|
|
|
|
|
|
BIGNUM * p, * n1, * n2, * A, * u, * iu;
|
2019-12-04 21:37:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
std::unique_ptr<Elligator2>& GetElligator ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|