Refactor IBAN checksum calculation into a separate function

This is useful when converting legacy account numbers to IBAN format.