Answer the question
In order to leave comments, you need to log in
How to remove extra text from a line?
There is a line:
$SHA$7b11fd7c3568e2cf$2e0380db347bbc210bb10c117dbcb7a7fdba831513eec387666571c7a3ca051e
$salt = 7b11fd7c3568e2cf
$hash = 2e0380db347bbc210bb10c117dbcb7a7fdba831513eec387666571c7a3ca051e
Answer the question
In order to leave comments, you need to log in
$var = '$SHA$7b11fd7c3568e2cf$2e0380db347bbc210bb10c117dbcb7a7fdba831513eec387666571c7a3ca051e';
$var = str_replace('$SHA$', '', $var);
$var_a = explode('$', $var);
$salt = $var_a[0];
$hash = $var_a[1];
echo $salt.'<br/>'.$hash;
$regexp = '/^\$SHA\$([a-f0-9]+)\$([a-f0-9]+)$/';
$hash = '$SHA$7b11fd7c3568e2cf$2e0380db347bbc210bb10c117dbcb7a7fdba831513eec387666571c7a3ca051e';
$matches = [];
preg_match($regexp, $hash, $matches);
echo 'Хэш: ', $matches[2], '. Соль: ', $matches[1], '.';
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question