3

I can´t find which algorithm is being used to to calculate the 2 digits check digit of my bank references.

Some examples

0404 3295 60983
0707 3328 25810
0900 9907 32991
0900 8912 91695
0707 2268 89938
0808 1153 45010
0808 0964 91963
0900 6632 28254
0707 2802 64344
0909 0256 01882
0707 3004 54587
0707 3164 30453
0404 2914 27064
0707 3306 30672
0404 1467 53870
0808 1733 55047
0808 2349 11733
0707 3158 51956
0707 3346 64573
0404 3396 83589

I know that the last 2 digits are the check digits, because of the user account.

for example:
Area: 040
User account: 43266008
Bank reference: 0404 3266 00828
so... 28 <- Check digits.

I tried with Mod 97 and Base 10 (Luhn)

I don't know other algorithms like: Mod 22, Base 36, Algorithm 45

¿Any idea?

Grouping and counting my samples, if it help for something:

CheckDigits SamplesCount
01  2720
02  2698
03  2743
04  2719
05  2820
06  2737
07  2795
08  2737
09  2760
10  2778
11  2787
12  2780
13  2779
14  2658
15  2711
16  2770
17  2718
18  2675
19  2669
20  2675
21  2780
22  2737
23  2721
24  2723
25  2631
26  2694
27  2615
28  2800
29  2903
30  2718
31  2712
32  2733
33  2813
34  2782
35  2820
36  2754
37  2686
38  2755
39  2774
40  2688
41  2738
42  2799
43  2669
44  2774
45  2754
46  2623
47  2684
48  2711
49  2740
50  2735
51  2658
52  2793
53  2752
54  2782
55  2818
56  2718
57  2735
58  2738
59  2755
60  2716
61  2818
62  2738
63  2716
64  2710
65  2607
66  2640
67  2799
68  2763
69  2827
70  2968
71  2734
72  2679
73  2758
74  2730
75  2856
76  2713
77  2768
78  2694
79  2684
80  2693
81  2798
82  2739
83  2809
84  2754
85  2710
86  2833
87  2820
88  2739
89  2733
90  2739
91  2745
92  2805
93  2686
94  2771
95  2758
96  2754
97  2688

Example: enter image description here

The reference for Sears and Oxxo have a check digit that is Mod10 (Luhn).

(You can calculate the luhn check digit in this page: https://planetcalc.com/2464/)

Reference: 0900 5719 759
Check digit (Luhn): 3

How do i get the 88?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Fraga
  • 1,361
  • 2
  • 15
  • 47
  • 3
    What is a "bank reference"? Where are these values coming from? (Does it not have any documentation?) – ruakh Jul 02 '17 at 00:50
  • A Bank reference Is a number that a company gives you to make a payment in a bank. In this case is for a cellphone company here in Mexico. They give this number to their clients so they can pay their service in a bank or some stores. – Fraga Jul 02 '17 at 06:17
  • This values are from some clients. but no matter what are the numbers. the important part is the "check digit"... like credit cards... they have a check digit at the end so you don't miss any number when writing, credit cards use the Luhn algorithm. Some banks use the Mod 97, they are all common algorithms... I just can't find which algorithm this company is using. – Fraga Jul 02 '17 at 06:20
  • Have you tried asking them? It may not be a standard algorithm. – ruakh Jul 02 '17 at 06:24
  • Yes, I tried!... something curious is that if i look at the check digits of all the samples i have, they start from 01 to 97... so I'm sure is the Mod 97 algorithm but i cant make it work. – Fraga Jul 04 '17 at 16:41
  • It should not assume that the mod of 97 only by observing sample data – Zico Jul 04 '17 at 16:50
  • It looks like you are missing something - according to the [Mexico's standard](https://bank.codes/api-mexico-clabe/) user account is 10 digits long (their example makes it clear that penultimate digit has no meaning) so it looks like you have only account numbers without validation data. Also `CLABE` is used there instead of `IBAN`. – user3707125 Jul 04 '17 at 23:07
  • This are bank references to pay Telcel (Phone company) in Banamex (Citibank) You just go to the bank, with that number and then you can pay. – Fraga Jul 05 '17 at 04:17
  • Well, considering that the bank is Banamex, next code is verified correctly by the [CLABE validator](https://bank.codes/mexico-clabe-checker/) - `002040432660082816`: I generated CLABE check digit from you data, and added bank code prefix and a penultimate `1`, which may refer e.g. to the currency of the account and may not be needed for local payment. Considering that it is rather unlikely that [bank.codes](https://bank.codes) doesn't support correct data (as it follows strict standard) - I make a conclusion that you don't have the check digit. – user3707125 Jul 05 '17 at 07:56
  • I will add more info in the description. That may help to clarify – Fraga Jul 05 '17 at 21:02
  • 1
    If the bank supports e-banking, then you might find a javascript validation of the input on the client side (e.g. if they check if the input can be valid on the client side before even sending it to the server where the critical checks happen). – maraca Jul 09 '17 at 17:18
  • Funny, but I can;t imagine what you plan to do with it once you figure the algorithm out. I'm guessing you want to figure it out just for fun purposes. – Divij Sehgal Jul 11 '17 at 06:58
  • Some of the algorithms require key. You cant figure out easily if you don't know key. It could be one of the non-standard algorithm as well. Ask one who wrote it. – Zaki Anwar Hamdani Jul 11 '17 at 07:18
  • Have you tried hashing the digits and see if maybe the checksum is just part of the hash? since they are so regularily distributed this might be the case.. – Alekos Filini Jul 11 '17 at 15:31

1 Answers1

1

Maybe this will be helpful, it includes the methods you described: https://docs.oracle.com/cd/E18727_01/doc.121/e13483/T359831T498954.htm

Ohad Rubin
  • 460
  • 3
  • 13
  • Looks quite right, but I don't see a variant that would be using modulo operation with 98 as the divisor (and looking at the "grouping" section of the post with question, it looks like that's what has been used) – synweap15 Jul 11 '17 at 14:29