Static Public Member Functions | |
| static | randomSalt () |
| Generate a random 256bit-salt. | |
| static | encrypt ($data, $salt) |
| Encrypt data with given salt (use randomSalt() to generate one). | |
| static | verify ($data, $encrypted, $salt) |
| Verify data by comparing it to encrypted value. | |
| static | safeHash ($data, $salt) |
| Generates a hash that can be published. | |
| static | verifySafeHash ($safeHash, $encrypted, $salt) |
| Verifies a hash generated by safeHash(). | |
Static Private Member Functions | |
| static | hash ($data, $salt, $rounds) |
| Creates a hash with the given number of rounds. | |
Definition at line 6 of file Crypto.class.php.
| static spunQ_Crypto::encrypt | ( | $ | data, | |
| $ | salt | |||
| ) | [static] |
Encrypt data with given salt (use randomSalt() to generate one).
The encrypted data can be verified by encrypting the same data with the same salt. The result should be identical. This is what verify() does.
| $data | The data to encrypt. | |
| $salt | The salt value to use. |
Definition at line 25 of file Crypto.class.php.
| static spunQ_Crypto::hash | ( | $ | data, | |
| $ | salt, | |||
| $ | rounds | |||
| ) | [static, private] |
Creates a hash with the given number of rounds.
| $data | The data to encrypt. | |
| $salt | The salt value to use. | |
| $rounds | Number of rounds to encrypt. |
Definition at line 72 of file Crypto.class.php.
| static spunQ_Crypto::randomSalt | ( | ) | [static] |
| static spunQ_Crypto::safeHash | ( | $ | data, | |
| $ | salt | |||
| ) | [static] |
Generates a hash that can be published.
This function should be used whenever a hash value must leave the system. It provides a hash value (a string) that can be sent as a cookie, for example, to keep users logged in.
| $data | The data to encrypt. | |
| $salt | The salt value to use. |
Definition at line 49 of file Crypto.class.php.
| static spunQ_Crypto::verify | ( | $ | data, | |
| $ | encrypted, | |||
| $ | salt | |||
| ) | [static] |
Verify data by comparing it to encrypted value.
| $data | The data to verify. | |
| $encrypted | Previously encrypted data. | |
| $salt | The salt that was used for the encryption. |
Definition at line 36 of file Crypto.class.php.
| static spunQ_Crypto::verifySafeHash | ( | $ | safeHash, | |
| $ | encrypted, | |||
| $ | salt | |||
| ) | [static] |
Verifies a hash generated by safeHash().
Same as verify(), but for return values of the safeHash() function.
| $safeHash | Return value of the safeHash() function. | |
| $encrypted | Previously encrypted data (using encrypt()). | |
| $salt | The salt that was used for the encryption. |
Definition at line 61 of file Crypto.class.php.
1.5.9