Skip to content

Instantly share code, notes, and snippets.

View DevAbolfazl's full-sized avatar

Abolfazl Z. DevAbolfazl

View GitHub Profile
@DevAbolfazl
DevAbolfazl / hlds-algo.php
Created September 1, 2023 13:33
Hash length-dependent security (HLDS)
<?php
/*
HLDS is a one-way hash algorithm in php language, depending on the length of the primary string, its security and difficulty are also higher and it breaks into words. Due to the use of random mechanism, it returns different values for each string.
It is very useful for storing passwords and sensitive data because it is difficult to check whether the numbers match the string or not.
*/
function convertSaltToNum (string $salt): string|false
{
$chars = str_split($salt);