<?php
/**
/* @author Jonatan Villela
/* @copyright 2011
*/
/////// Este Script é válido para as versões 1.5.x, 1.7.x e 2.5
/** 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 />";
Tipos de criptografias gerados na função getCryptedPassword
com salt padrão
md5-hex: bc607542df6c9a61bcb1c66828f94e4a:h5ZFxohk
com salt de 64 caracteres
md5-hex com salt 64 caracteres: 0078d963209e0b9896d5d66159efeb44:cuMdfBKlYkzm9U4RyMxb1Px8wwnGVhi1FUUmdE770b3q66s3KXpZdwNo2Kz7eiIf
Sha: k9UfUvvf4elE8IRyffJJk+iMruc=:h5ZFxohk
Crypt: h5QnWQkFO1d5.:h5ZFxohk
crypt-des: h5QnWQkFO1d5.:h5ZFxohk
crypt-md5: h5QnWQkFO1d5.:h5ZFxohk
crypt-blowfish: h5QnWQkFO1d5.:h5ZFxohk
md5-base64: fGfnE6S0E5cC3hpPrGcjRA==:h5ZFxohk
ssha: NTzs8OsXRmeke3XirIhvXqG74V1oNVpGeG9oaw==:h5ZFxohk
smd5: vGB1Qt9smmG8scZoKPlOSmg1WkZ4b2hr:h5ZFxohk
aprmd5: $apr1$h5ZFxohk$d4sLbbYJSYlnARc4PFMV/0:h5ZFxohk
?>
0sem comentários ainda