php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
php_password.h
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Copyright (c) The PHP Group |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.01 of the PHP license, |
6 | that is bundled with this package in the file LICENSE, and is |
7 | available through the world-wide-web at the following url: |
8 | https://www.php.net/license/3_01.txt |
9 | If you did not receive a copy of the PHP license and are unable to |
10 | obtain it through the world-wide-web, please send a note to |
11 | license@php.net so we can mail you a copy immediately. |
12 +----------------------------------------------------------------------+
13 | Authors: Anthony Ferrara <ircmaxell@php.net> |
14 | Charles R. Portwood II <charlesportwoodii@erianna.com> |
15 +----------------------------------------------------------------------+
16*/
17
18#ifndef PHP_PASSWORD_H
19#define PHP_PASSWORD_H
20
23
24#define PHP_PASSWORD_DEFAULT PHP_PASSWORD_BCRYPT
25#define PHP_PASSWORD_BCRYPT_COST 12
26
27#ifdef HAVE_ARGON2LIB
34#define PHP_PASSWORD_ARGON2_MEMORY_COST (64 << 10)
35#define PHP_PASSWORD_ARGON2_TIME_COST 4
36#define PHP_PASSWORD_ARGON2_THREADS 1
37#endif
38
39typedef struct _php_password_algo {
40 const char *name;
41 zend_string *(*hash)(const zend_string *password, zend_array *options);
42 bool (*verify)(const zend_string *password, const zend_string *hash);
43 bool (*needs_rehash)(const zend_string *password, zend_array *options);
45 bool (*valid)(const zend_string *hash);
47
49#ifdef HAVE_ARGON2LIB
50extern const php_password_algo php_password_algo_argon2i;
51extern const php_password_algo php_password_algo_argon2id;
52#endif
53
55PHPAPI void php_password_algo_unregister(const char*);
59
61static inline const php_password_algo* php_password_algo_identify(const zend_string *hash) {
63}
64
65
66#endif
hash(string $algo, string $data, bool $binary=false, array $options=[])
Definition hash.stub.php:12
const php_password_algo php_password_algo_bcrypt
Definition password.c:224
#define PHP_MSHUTDOWN_FUNCTION
Definition php.h:401
#define PHP_MINIT_FUNCTION
Definition php.h:400
#define PHPAPI
Definition php.h:71
PHP_JSON_API size_t int options
Definition php_json.h:102
PHPAPI void php_password_algo_unregister(const char *)
Definition password.c:45
PHPAPI const php_password_algo * php_password_algo_find(const zend_string *)
Definition password.c:459
struct _php_password_algo php_password_algo
PHPAPI const php_password_algo * php_password_algo_identify_ex(const zend_string *, const php_password_algo *)
Definition password.c:528
PHPAPI int php_password_algo_register(const char *, const php_password_algo *)
Definition password.c:40
PHPAPI zend_string * php_password_algo_extract_ident(const zend_string *)
Definition password.c:510
PHPAPI const php_password_algo * php_password_algo_default(void)
Definition password.c:455
bool(* valid)(const zend_string *hash)
int(* get_info)(zval *return_value, const zend_string *hash)
zend_string *(* hash)(const zend_string *password, zend_array *options)
bool(* needs_rehash)(const zend_string *password, zend_array *options)
const char * name
bool(* verify)(const zend_string *password, const zend_string *hash)
struct _zval_struct zval
struct _zend_string zend_string
struct _zend_array zend_array
zval * return_value