A
A
Anton2016-07-18 13:02:13
PHP
Anton, 2016-07-18 13:02:13

How to get password hash longer than 31 characters?

Good day.
It is necessary to hash passwords up to 65 characters long using the sha256 algorithm.
As it turned out, the hash function cuts the password to 31 characters, and the resulting hash differs from the original.
How can I increase this limit, or maybe there are other options?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mikhail Osher, 2016-07-18
@miraage

Fuck all this nonsense. PHP has great built-in functions.
php.net/manual/en/function.password-hash.php
php.net/manual/en/function.password-verify.php

D
Dmitry Entelis, 2016-07-18
@DmitriyEntelis

Are you sure that it is the hash function that cuts off?
Here is the test https://3v4l.org/ZTHTg , nothing is cut off, the hashes are different.

A
Alexey, 2016-07-18
@alsopub

$s1 = "1234567890123456789012345678901";
$s2 = "$s1$s1$s1";

echo(hash('sha256', $s1).'<br>');
echo(hash('sha256', $s2).'<br>');

What is cut off? I do not see.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question