DomBlack / php-scrypt

A PHP wrapper fo the scrypt hashing algorithm
Other
209 stars 57 forks source link

Updates to have scrypt use PHP memory limits memory #33

Closed ghost closed 9 years ago

ghost commented 10 years ago

Giving this one a try on Travis.

Since memory allocation was moved to emalloc, I removed all the max memory checks in params.c that were to get some form of system memory. Instead I replaced it with grabbing the current PHP max memory and subtracting the currently used memory. Since BEST case scenario is for 50% of the memory to be used we can see if that is safe or not. The pickparams test is probably going to fail since it doesn't have my changes in it: gettype(scrypt_pickparams(1024, 0.75, 1000));

My limits code is working in raw bytes, wheras this seems to be expecting kB? So either I need to update my code to convert bytes to K, or these numbers need to be made either much much larger or set to 0.

ghost commented 10 years ago

gah... there must be something on my desktop installed which provides a library that lets this compile. I'm going to have to figure out a virtualbox setup so I can run this on a vanilla ubuntu install

DomBlack commented 9 years ago

@garyamort Did you ever find the cause of the build failures, or should I close this PR for now?

sergey-dryabzhinsky commented 9 years ago

garyamort, Error appears here: https://github.com/DomBlack/php-scrypt/pull/33/files#diff-cb75073251cc661345e643a9e1f33781R344 You probably use thread-safe build of PHP. But on most linux distros it is not TS.

DomBlack commented 9 years ago

Closing due to inactivity.