Tipo de criptografia na classe do Joomla JUserHelper::getCryptedPassword
20 de Abril de 2011, 0:00<?php
/**
/* @author Jonatan Villela
/* @copyright 2011
Tipo de criptografia na classe do Joomla JUserHelper::getCryptedPassword
20 de Abril de 2011, 0:00<?php
/**
* @author hat 1
* @copyright 2011
*/
/**
* @author Jonatan Villela
* @copyright 2010
*/
/** Texto a ser criptografado
* */
$Password_reversion = 'minhasenha';
/////////////////
/**
* O Salt manda muito na força da senha entao lembre-se sempre do salt mais nao deixe muito grande
* quanto maior o salt maior o processamento do processador do servidor para gerar sequencias
*
* */
$salt = JUserHelper::genRandomPassword();
$salt64char = JUserHelper::genRandomPassword('64');
/** Examples of password strength
* tipos de criptografias aceitos na função getCryptedPassword
*
*plain
*sha
*crypt
*crypt-des
*crypt-md5
*crypt-blowfish
*md5-base64
*ssha
*smd5
*aprmd5
*/
$cryptmd5hex = JUserHelper::getCryptedPassword($Password_reversion, $salt, 'md5-hex');
/**
* Criando uma sequencia com salt maior
* */
$cryptmd5hex64char = JUserHelper::getCryptedPassword($Password_reversion, $salt64char, 'md5-hex');
$cryptsha = JUserHelper::getCryptedPassword($Password_reversion, $salt, 'sha');
$cryptcrypt= JUserHelper::getCryptedPassword($Password_reversion, $salt, 'crypt');
$cryptcryptdes= JUserHelper::getCryptedPassword($Password_reversion, $salt, 'crypt-des');
$cryptcryptmd5 = JUserHelper::getCryptedPassword($Password_reversion, $salt, 'crypt-md5');
$cryptcryptblowfish = JUserHelper::getCryptedPassword($Password_reversion, $salt, 'crypt-blowfish');
$cryptmd5base64 = JUserHelper::getCryptedPassword($Password_reversion, $salt, 'md5-base64');
$cryptssha = JUserHelper::getCryptedPassword($Password_reversion, $salt, 'ssha');
$cryptsmd5 = JUserHelper::getCryptedPassword($Password_reversion, $salt, 'smd5');
$cryptaprmd5 = JUserHelper::getCryptedPassword($Password_reversion, $salt, 'aprmd5');
$termino_md5hex = $cryptmd5hex.':'.$salt;
$termino_md5hex64char = $cryptmd5hex64char.':'.$salt64char;
$termino_sha = $cryptsha.':'.$salt;
$termino_crypt = $cryptcrypt.':'.$salt;
$termino_cryptdes = $cryptcryptdes.':'.$salt;
$termino_cryptmd5 = $cryptcryptmd5.':'.$salt;
$termino_cryptblowfish = $cryptcryptblowfish.':'.$salt;
$termino_cryptmd5base64 = $cryptmd5base64.':'.$salt;
$termino_cryptssha = $cryptssha.':'.$salt;
$termino_cryptsmd5 = $cryptsmd5.':'.$salt;
$termino_cryptaprmd5 = $cryptaprmd5.':'.$salt;
echo "md5-hex: " . $termino_md5hex . "<br /><br />";
echo "md5-hex com salt 64 caracteres: " . $termino_md5hex64char . "<br /><br />";
echo "Sha: " . $termino_sha . "<br /><br />";
echo "Crypt: " . $termino_crypt . "<br /><br />";
echo "crypt-des: " . $termino_cryptdes . "<br /><br />";
echo "crypt-md5: " . $termino_cryptmd5 . "<br /><br />";
echo "crypt-blowfish: " . $termino_cryptblowfish . "<br /><br />";
echo "md5-base64: " . $termino_cryptmd5base64 . "<br /><br />";
echo "ssha: " . $termino_cryptssha . "<br /><br />";
echo "smd5: " . $termino_cryptsmd5 . "<br /><br />";
echo "aprmd5: " . $termino_cryptaprmd5 . "<br /><br />";