{"action":"created","issue":{"url":"https://api.github.com/repos/arthurdejong/python-stdnum/issues/32","repository_url":"https://api.github.com/repos/arthurdejong/python-stdnum","labels_url":"https://api.github.com/repos/arthurdejong/python-stdnum/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/arthurdejong/python-stdnum/issues/32/comments","events_url":"https://api.github.com/repos/arthurdejong/python-stdnum/issues/32/events","html_url":"https://github.com/arthurdejong/python-stdnum/issues/32","id":144920287,"number":32,"title":"Mexican RFC check digit","user":{"login":"TrymBeast","id":1187322,"avatar_url":"https://avatars.githubusercontent.com/u/1187322?v=3","gravatar_id":"","url":"https://api.github.com/users/TrymBeast","html_url":"https://github.com/TrymBeast","followers_url":"https://api.github.com/users/TrymBeast/followers","following_url":"https://api.github.com/users/TrymBeast/following{/other_user}","gists_url":"https://api.github.com/users/TrymBeast/gists{/gist_id}","starred_url":"https://api.github.com/users/TrymBeast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TrymBeast/subscriptions","organizations_url":"https://api.github.com/users/TrymBeast/orgs","repos_url":"https://api.github.com/users/TrymBeast/repos","events_url":"https://api.github.com/users/TrymBeast/events{/privacy}","received_events_url":"https://api.github.com/users/TrymBeast/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-31T14:36:25Z","updated_at":"2016-04-01T12:21:06Z","closed_at":null,"body":"The Mexican RFC check digit is being miscalculated when it should be an \"A\".\r\nThe example to check that is: \"MAHM670102NJA\".\r\n\r\nFrom the document that is in the comments:\r\n\"Si el residuo es igual a 10 el dígito verificador será  “ A”.\"\r\n\r\nIf the remainder equals 10, then the check digit is an \"A\".\r\nBut the function that calculates the check digit returns \"1\"."},"comment":{"url":"https://api.github.com/repos/arthurdejong/python-stdnum/issues/comments/204376880","html_url":"https://github.com/arthurdejong/python-stdnum/issues/32#issuecomment-204376880","issue_url":"https://api.github.com/repos/arthurdejong/python-stdnum/issues/32","id":204376880,"user":{"login":"arthurdejong","id":3147789,"avatar_url":"https://avatars.githubusercontent.com/u/3147789?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurdejong","html_url":"https://github.com/arthurdejong","followers_url":"https://api.github.com/users/arthurdejong/followers","following_url":"https://api.github.com/users/arthurdejong/following{/other_user}","gists_url":"https://api.github.com/users/arthurdejong/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurdejong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurdejong/subscriptions","organizations_url":"https://api.github.com/users/arthurdejong/orgs","repos_url":"https://api.github.com/users/arthurdejong/repos","events_url":"https://api.github.com/users/arthurdejong/events{/privacy}","received_events_url":"https://api.github.com/users/arthurdejong/received_events","type":"User","site_admin":false},"created_at":"2016-04-01T12:21:06Z","updated_at":"2016-04-01T12:21:06Z","body":"Hi,\r\n\r\nThanks for pointing this out. I think I worked based on a Google translate version of the document so probably missed a few things. I also found a lot of numbers that do not pass the check digit validation (that is why the check digit validation is disabled by default).\r\n\r\nThe thing in the text that is not clear to me is if the value of 10 refers to the sum modulo 11 or 11 minus that value.\r\nSpecifically, if the sum modulo 11 (S) is, the remainder (R = 11 - S) will be (R), what would the check digit (C) be (C1 is the current code, C2 is another interpretation):\r\n\r\n S |  R | C1 | C2\r\n---|----|----|-----\r\n 0 |  - |  0 |  0\r\n 1 | 10 |  A |  1?\r\n 2 |  9 |  9 |  9\r\n 3 |  8 |  8 |  8\r\n 4 |  7 |  7 |  7\r\n 5 |  6 |  6 |  6\r\n 6 |  5 |  5 |  5\r\n 7 |  4 |  4 |  4\r\n 8 |  3 |  3 |  3\r\n 9 |  2 |  2 |  2\r\n10 |  1 |  1 |  A?\r\n\r\nFrom my test-set of about 85000 numbers with the existing calculation (C1) about 1.40% fail the check digit check, if I switch to the alternative calculation (C2) about 19.3% of the numbers fail and if both are accepted about 1.35% fail.\r\n\r\nThat seems to indicate that C1 is more likely to be correct than C2 (if my testset is OK).\r\n\r\nDo you have any clearer sources for the check digit validation or perhaps know of an online service where numbers can be checked?\r\n"}}