public class Cryptography

class.cryptography.php #17

Cryptography is a utility class that offers a number of general purpose cryptography- related functions for message digestation as well as (backwards-)compatibility checking. The message digestation algorithms are placed in the subclasses MD5, SHA1 and PBKDF2.

Methods

static boolean compare(string $input, string $hash, boolean $isHash)

Compares a given hash with a clean text password by figuring out the algorithm that has been used and then calling the appropriate sub-class

Parameters
  • $input stringthe cleartext password

  • $hash stringthe hash the password should be checked against

Returns

the result of the comparison

See Also
static string generateSalt(integer $length)

Generates a salt to be used in message digestation.

Parameters
  • $length integerthe length of the salt

Returns

a hexadecimal string

static string hash(string $input)

Uses an instance of PBKDF2 to create a hash. If you require other hashes, see the related functions of the MD5 or SHA1 classes

Parameters
  • $input stringthe string to be hashed

Returns

the hashed string

See Also
static boolean requiresMigration(string $hash)

Checks if provided hash has been computed by most recent algorithm returns true if otherwise

Parameters
  • $hash stringthe hash to be checked

Returns

whether the hash should be re-computed

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details