diff options
Diffstat (limited to 'nacl/crypto_auth/wrapper-auth.cpp')
-rw-r--r-- | nacl/crypto_auth/wrapper-auth.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/nacl/crypto_auth/wrapper-auth.cpp b/nacl/crypto_auth/wrapper-auth.cpp new file mode 100644 index 00000000..2108aa31 --- /dev/null +++ b/nacl/crypto_auth/wrapper-auth.cpp | |||
@@ -0,0 +1,11 @@ | |||
1 | #include <string> | ||
2 | using std::string; | ||
3 | #include "crypto_auth.h" | ||
4 | |||
5 | string crypto_auth(const string &m,const string &k) | ||
6 | { | ||
7 | if (k.size() != crypto_auth_KEYBYTES) throw "incorrect key length"; | ||
8 | unsigned char a[crypto_auth_BYTES]; | ||
9 | crypto_auth(a,(const unsigned char *) m.c_str(),m.size(),(const unsigned char *) k.c_str()); | ||
10 | return string((char *) a,crypto_auth_BYTES); | ||
11 | } | ||