8

I have the following numbers. It is a 14 digit identification number. The first 13 digits (counting from left) are the number itself, the 14th (the least digit) digit is an integrity check code. I tried many combinations but failed to get the formula which this integrity check is done.

decimal, 14 dig.| hexadecimal  | binary (grouped)
--------------------------------------
//effect of the least (decimal) digit
2840115110085 6 | 19d4a885c7b8 | 1100 1110 1010 0101 0100 0100 0010 1110 0011 1101 1100
2840115110086 4 | 19d4a885c7c0 | 1100 1110 1010 0101 0100 0100 0010 1110 0011 1110 0000
2840115110087 2 | 19d4a885c7c8 | 1100 1110 1010 0101 0100 0100 0010 1110 0011 1110 0100
2840115110088 1 | 19d4a885c7d1 | 1100 1110 1010 0101 0100 0100 0010 1110 0011 1110 1000
2840115110089 9 | 19d4a885c7e3 | 1100 1110 1010 0101 0100 0100 0010 1110 0011 1111 0001
//effect of changing 7th digit from left.
2840113000000 2 | 19d4a743ce82 | 1100 1110 1010 0101 0011 1010 0001 1110 0111 0100 0001
2840114000000 1 | 19d4a7dc6501 | 1100 1110 1010 0101 0011 1110 1110 0011 0010 1000 0000
2840115000000 9 | 19d4a874fb89 | 1100 1110 1010 0101 0100 0011 1010 0111 1101 1100 0100
2840116000000 7 | 19d4a90d9207 | 1100 1110 1010 0101 0100 1000 0110 1100 1001 0000 0011
2840117000000 5 | 19d4a9a62885 | 1100 1110 1010 0101 0100 1101 0011 0001 0100 0100 0010
2840118000000 3 | 19d4aa3ebf03 | 1100 1110 1010 0101 0101 0001 1111 0101 1111 1000 0001
2840119000000 1 | 19d4aad75581 | 1100 1110 1010 0101 0101 0110 1011 1010 1010 1100 0000
2840110000000 8 | 19d4a57a0b08 | 1100 1110 1010 0101 0010 1011 1101 0000 0101 1000 0100

Here's a little Python script which was used to produce above listing:

nums = [
28401151100856, 28401151100864, 28401151100872, 28401151100881,
28401151100899, 28401130000002, 28401140000001, 28401150000009,
28401160000007, 28401170000005, 28401180000003, 28401190000001,
28401100000008,
]

def _2fmtdecimal(x):
        tmp = str(x)
        return tmp[0:13] + ' ' + tmp[13:]

def _2fmtbinary(x):
        tmp = bin(x)[2:]
        tmp2 = ''
        for i,j,k,l in zip(tmp[::4], tmp[1::4], tmp[2::4], tmp[3::4]):
                tmp2 += i+j+k+l + ' '
        return tmp2

for i in nums:
        print "%s | %s | %s" % (_2fmtdecimal(i), hex(i), _2fmtbinary(i))
asheeshr
  • 2,465
  • 8
  • 28
  • 41
Yousf
  • 189
  • 3
  • Counting from left (fixed the question). It is a black box, you pass the 13 digits and it gives you the integrity check digit. I want to replace the black box. – Yousf Jun 06 '13 at 11:56
  • Can you give us the integrity check bits for all 0's and all 1's? maybe other such end-case nubmers? – NirIzr Jun 06 '13 at 13:20
  • Also, a list of sequential numbers that loops more then once will be great (a repeating sequence of integrity bits).

    p.s. it's only a bit, why not just guessing it? you have a 50% chance nailing it on the first try

    – NirIzr Jun 06 '13 at 13:29
  • 2
    @NirIzr: it's a decimal digit, not a single bit. – 0xC0000022L Jun 06 '13 at 13:55
  • @NirIzr it is a decimal digit, chance is 10%. – Yousf Jun 06 '13 at 13:58
  • 1
    In what context is this data being used? Can you just brute-force the integrity check code? – Jason Geffner Jun 06 '13 at 14:07
  • @JasonGeffner If you have any idea about brute forcing it, I can try it. – Yousf Jun 06 '13 at 14:33
  • @Yousf: brute-forcing is guessing all the possible values and trying them one at a time until you provide the correct value. It only works if the range of legit values is relatively small and you can make the appropriate amount of attempts without triggering some lock-down/anti-brute-force mechanism. it also depends on the use case. Since you only have to guess one digit, there're only 10 possible values so it'll take you a maximum of 10 attempts to guess a single integrity check. to give better solutions, please also write abit about the context - why do you need the bit, how it's used, etc. – NirIzr Jun 06 '13 at 15:07
  • @Nirlzr This is what I do now, but it means 9 failed trials for each input. I think you were talking about brute forcing the CRC polynomial. – Yousf Jun 06 '13 at 17:41
  • Nope, I wasn't suggesting you brute-force the CRC. I meant you could brute-force the single checksum digit. – Jason Geffner Jun 06 '13 at 17:44
  • @Yousf: what is the issue with having failures? If automated, it'll take only a fraction. If you want us to try diagnosing the algorithm, please provide more numbers as i requested in my previous comments; or better yet, the blackbox if possible. have you considered getting the code and reversing the algorithm? – NirIzr Jun 06 '13 at 19:01
  • @Yousf: voting to close. Clearly you must have more information than we have, because you can produce valid numbers somehow. Whereas we're left in the dark about vital details but are expected to answer with something useful nevertheless. – 0xC0000022L Jun 07 '13 at 14:47
  • @0xC0000022L: If Yousf won't provide the needed details i'd still like to provide some kind of answer, for a more general case. also, this question is only one day old. – NirIzr Jun 07 '13 at 19:18
  • @NirIzr: you don't need anyone's approval. Just write your answer and if it is good, you'll get upvotes. If we get more details you can still edit your answer to amend it. So go for it :) – 0xC0000022L Jun 07 '13 at 19:25
  • 1
    Can you give us more values? At least a range of 20 consecutive values, and also some values with transposed digits, and the effect of systematically varying the next-to-last non-checksum digit. – Gilles 'SO- stop being evil' Jul 12 '13 at 21:32

1 Answers1

1

Most of integrity checks use some algebraic coding. Algebraic codings have a basis, so if you have enough samples you can possibly reconstruct the algebraic basis used.

Nikos M.
  • 201
  • 1
  • 4