Commits

Kelvin Wong committed f703e6c Draft

PY_LONG_LONG per pyport.h and Py_ssize_t use per PEP 353. Interestingly this code optimizes to O2, just like original scrypt 1.1.6 if you remove the Py_ssize_t references and use plain old int types for the length variables.

Comments (0)

Files changed (1)

  * SUCH DAMAGE.
  */
 
+#ifdef PY_SSIZE_T_CLEAN
+#define PY_SSIZE_T_CLEAN
+#endif
+
 #include <Python.h>
 
 #include "scryptenc/scryptenc.h"
 
 static PyObject *scrypt_hash(PyObject *self, PyObject *args, PyObject* kwargs) {
     PyStringObject *password,   *salt;
-    int passwordlen, saltlen;
+    Py_ssize_t passwordlen, saltlen;
     int paramerror, hasherror;
-    unsigned long long int N = 1 << 14;
+    unsigned PY_LONG_LONG N = 1 << 14;
     unsigned long int r = 8;
     unsigned long int p = 1;
     unsigned char *outbuf;