wrapper-auth.cpp 411 B

1234567891011
  1. #include <string>
  2. using std::string;
  3. #include "crypto_onetimeauth.h"
  4. string crypto_onetimeauth(const string &m,const string &k)
  5. {
  6. if (k.size() != crypto_onetimeauth_KEYBYTES) throw "incorrect key length";
  7. unsigned char a[crypto_onetimeauth_BYTES];
  8. crypto_onetimeauth(a,(const unsigned char *) m.c_str(),m.size(),(const unsigned char *) k.c_str());
  9. return string((char *) a,crypto_onetimeauth_BYTES);
  10. }