Subversion Repositories oidplus

Rev

Rev 797 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 797 Rev 1130
Line 16... Line 16...
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
18
 * limitations under the License.
19
 */
19
 */
20
 
20
 
-
 
21
/**
-
 
22
 * @param int $treshold_secs
-
 
23
 * @param bool $verbose
-
 
24
 * @return int
-
 
25
 */
21
function bcrypt_rounds($treshold_secs, $verbose=true) {
26
function bcrypt_rounds(int $treshold_secs, bool $verbose=true): int {
22
	if ($verbose) echo "Searching BCrypt cost (rounds) for <$treshold_secs secs...\n";
27
	if ($verbose) echo "Searching BCrypt cost (rounds) for <$treshold_secs secs...\n";
23
	$found = 31;
28
	$found = 31;
24
	for ($rounds=4; $rounds<=31; $rounds++) { // 4..31 is the valid range of PHP Bcrypt
29
	for ($rounds=4; $rounds<=31; $rounds++) { // 4..31 is the valid range of PHP Bcrypt
25
		$x = time();
30
		$x = time();
26
		$start = microtime(true);
31
		$start = microtime(true);