How can i get current password in password policy rule?

Is it possible to implement a password policy rule that will compare the current password with the new one? So that if the new password differs from the current one by less than 6 characters, this rule will reject the password change. How can I access the current password from the code, namely from the password policy rule?
I read that the current passwords are stored encrypted, but in the Camunda interface, when changing the password, you specify the current one too.