Thursday, September 4, 2025
HomeLanguagesPHP password_algos() Function

PHP password_algos() Function

The password_algos() is an inbuilt function in PHP that returns the Ids which get available by the password hashing algorithm. Here, Id represents the array of strings.

Syntax:

password_algos(): array

Parameter: This function does not accept any parameter.

Return Value: This function returns an array containing the names of all supported password hashing algorithms. The array elements are strings representing the names of the hashing algorithms, such as bcrypt, argon2i, argon2id, sha256, and sha512, among others.

Example 1: The following code demonstrates the password_algos() function.

PHP




<?php
$algos = password_algos();
      
echo "Supported password hashing algorithms:\n";
foreach ($algos as $algo) {
    echo "- $algo\n";
}  
?>


Output:

Supported password hashing algorithms:
- 2y
- argon2i
- argon2id

Example 2: The following code demonstrates the password_algos() function.

PHP




<?php
$algo = 'argon2i';
if (in_array($algo, password_algos())) {
    echo "The $algo algorithm is supported.\n";
} 
else {
    echo "The $algo algorithm is not supported.\n";
}
?>


Output:

The argon2i algorithm is supported. 

Reference: https://www.php.net/manual/en/function.password-algos.php

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32264 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6629 POSTS0 COMMENTS
Nicole Veronica
11799 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11858 POSTS0 COMMENTS
Shaida Kate Naidoo
6749 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6698 POSTS0 COMMENTS
Umr Jansen
6716 POSTS0 COMMENTS