Changes to update Tomato RAF.
[tomato.git] / release / src / router / dnscrypt / src / libnacl / crypto_onetimeauth / wrapper-verify.cpp
blob248239ee92e0de6078ef8d7e682ac1fd3bfa21ef
1 #include <string>
2 using std::string;
3 #include "crypto_onetimeauth.h"
5 void crypto_onetimeauth_verify(const string &a,const string &m,const string &k)
7 if (k.size() != crypto_onetimeauth_KEYBYTES) throw "incorrect key length";
8 if (a.size() != crypto_onetimeauth_BYTES) throw "incorrect authenticator length";
9 if (crypto_onetimeauth_verify(
10 (const unsigned char *) a.c_str(),
11 (const unsigned char *) m.c_str(),m.size(),
12 (const unsigned char *) k.c_str()) == 0) return;
13 throw "invalid authenticator";