Better POD
[authen-passphrase-scrypt.git] / Scrypt.xs
1 #define PERL_NO_GET_CONTEXT
2 #include "EXTERN.h"
3 #include "perl.h"
4 #include "XSUB.h"
5
6 #include "ppport.h"
7
8 #include <scrypt-1.2.1/lib/crypto/crypto_scrypt.h>
9
10 MODULE = Authen::Passphrase::Scrypt PACKAGE = Authen::Passphrase::Scrypt
11
12 PROTOTYPES: DISABLE
13
14 SV*
15 crypto_scrypt(const uint8_t *passwd, size_t length(passwd), \
16 const uint8_t *salt, size_t length(salt), \
17 uint64_t N, uint32_t r, uint32_t p, size_t buflen)
18 CODE:
19 uint8_t *buf;
20 int err;
21 Newx(buf, buflen, uint8_t);
22 err = crypto_scrypt(passwd, XSauto_length_of_passwd, salt, XSauto_length_of_salt, N, r, p, buf, buflen);
23 if(err < 0)
24 croak("Error in crypto_scrypt");
25 RETVAL = newSVpvn((const char* const)buf, buflen);
26 Safefree(buf);
27 OUTPUT:
28 RETVAL
This page took 0.019431 seconds and 4 git commands to generate.