I am working on Xamarin.Forms project and users can create accounts, each account gets a unique id assigned when created. Should I be using a specific method for creating the id?
I am using
$id = hash(sha256, $now. $birthday);
Is there a chance there can be a duplicate generated? Should I be using a different method? Or is this fine?
Edit:
$id = hash(sha256, $date . $birthday);
if(DB::query('SELECT * FROM users WHERE id=:id', array(':id' => $id))){
$id = hash(sha256, $date . $birthday . rand(100, 999));
if(DB::query('SELECT * FROM users WHERE id=:id', array(':id' => $id))){
echo 'try_again';
return;
}
}