A diversity-based framework for dynamic password policy generation