wrapper-mult.cpp 464 B

123456789101112
  1. #include <string>
  2. using std::string;
  3. #include "crypto_scalarmult.h"
  4. string crypto_scalarmult(const string &n,const string &p)
  5. {
  6. unsigned char q[crypto_scalarmult_BYTES];
  7. if (n.size() != crypto_scalarmult_SCALARBYTES) throw "incorrect scalar length";
  8. if (p.size() != crypto_scalarmult_BYTES) throw "incorrect element length";
  9. crypto_scalarmult(q,(const unsigned char *) n.c_str(),(const unsigned char *) p.c_str());
  10. return string((char *) q,sizeof q);
  11. }