1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
def calculCCC( OO, Q, RRRRRR, EZABPQMCDU):
""""Retourne le code RIO.
Args:
OO -- identifiant de l'opérateur
Q -- qualité du client: E (entreprise) ou P (particulier)
RRRRRR -- identification du contrat
CCC -- code de contrôle
"""
concatenation = OO + Q + RRRRRR + EZABPQMCDU
ordre = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+"
a = b = c = 0
for i in range(19):
position = ordre.find(concatenation[i])
a = (1 * a + position) % 37
b = (2 * b + position) % 37
c = (4 * c + position) % 37
return ordre[a] + ordre[b] + ordre[c] |
Partager