When using the BCRYPT function is PHP, it produces a **, of course this is as expected. However it also adds unwanted characters such " . " (DOTS) when hashing, which again is to be expected.
I would like to know if there is a hashing function which I can use in PHP which doesn't create a hash which dots in it or if I can tell the hash function in some way not to create a hash with dots.
I am using this create a unique link key hash.
$passHash = password_hash($email, PASSWORD_BCRYPT);
Let me know.
Thanks in advance.
Seeing that this is for verification purposes, using the following is ample to use:
$code=substr(md5(mt_rand()),0,15);
The password_hash()
function does create a unique string, sure, but it just wasn't designed for doing verification purposes as you're doing now.
There's also this method that I use from time to time:
$token = substr(hash('sha512', mt_rand() . microtime()), 0, 50);
which will create an even longer and more precise token when using microtime()
.
Disclaimer: This is for random token generation and not related to password hashing.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments