Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
gensalt_blowfish example
function
HashPassword
(
$password
)
{
if
(
strlen
(
$password
)
> 4096
)
{
return
'*';
}
$random
= '';
if
(
CRYPT_BLOWFISH === 1 && !
$this
->portable_hashes
)
{
$random
=
$this
->
get_random_bytes
(
16
)
;
$hash
=
crypt
(
$password
,
$this
->
gensalt_blowfish
(
$random
)
)
;
if
(
strlen
(
$hash
)
=== 60
)
return
$hash
;
}
if
(
strlen
(
$random
)
< 6
)
$random
=
$this
->
get_random_bytes
(
6
)
;
$hash
=
$this
->
crypt_private
(
$password
,
$this
->
gensalt_private
(
$random
)
)
;
if
(
strlen
(
$hash
)
=== 34
)
return
$hash
;