I don't know the algorithm, but I think you're trying to do too much. IMO, you should be more liberal with what you put in the first 8 digits (something like `########` should do), and just compute a good modulo 11 checksum.