hibernate/hibernate-validator — pull request #263 by victor-rds (2013-08-01 00:03:44+00:00)
Title: HV-808 Fixing Mod11 Check and CPF Constraint

The the method mod11 used for CPF is giving false positives, it accepts invalid check digits as valid.

That happens because the check digit is being used in the checksum, this can lead to a situation where the digit validates itself, for example *378.796.950-01* and *378.796.950-02* are both valid according to CPF and ModCheck constraints but the second one is a invalid document with invakid check digit.

The mod11 method should calculate the mod and not validate it (return 0 if valid)

In the CPF constraint the exclusion patterns are missing some other known cases of invalid documents, all CPF numbers that is composed only by the same digit is a invalid document that passes the Mod11 check, not only those composed by only zeros or nines.