Version: current

# Class PasswordEncryptor_PHPHash

This is the default class used for built-in hash types in PHP. Please note that the implemented algorithms depend on the PHP distribution and architecture.

  PasswordEncryptor
  PasswordEncryptor_PHPHash

### Direct known subclasses

`PasswordEncryptor_LegacyPHPHash`

Package: sapphire\security
Located at sapphire/security/PasswordEncryptor.php

## Methods summary

`public` | # `__construct( String $algorithm )` #### Parameters $algorithm String $algorithm A PHP built-in hashing algorithm as defined by hash_algos()
`public string` | # `getAlgorithm( )` #### Returns `string` string
`public String` | # `encrypt( String $password, String $salt = null, `Member` $member = null )` Return a string value stored in the Member->Password property. The password should be hashed with `PasswordEncryptor::salt()` if applicable. Return a string value stored in the Member->Password property. The password should be hashed with `PasswordEncryptor::salt()` if applicable. #### Parameters $password String $password Cleartext password to be hashed $salt String $salt (Optional) $member Member $member (Optional) #### Returns `String` Maximum of 512 characters.

### Methods inherited from PasswordEncryptor

`compare()`, `create_for_algorithm()`, `get_encryptors()`, `register()`, `salt()`, `unregister()`

### Magic methods summary

## Properties summary

`protected string` | $algorithm | #

### Properties inherited from PasswordEncryptor

`$encryptors`

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -