Base 32 to binary converter

Jan 13, 2005 7 Replies

I have some magstripe cards that have a 9 digit(base 10) number reduced to 7 digits in base 32 to save space. (Go figure)



I need to output this in binary for use in an access control panel.



I am willing to build a small interface board. Any thoughts about any off the shelf technology before I start from scratch?



Thanks, Danno



How is the 9-digit decimal number 999999999 represented in the 7-digit base-32 format?

Tony Williams.

Since 999,999,999 fits in 32 bits (actually 30 bits), I presume that there is some advantage to using 7 5-bit groups (35 bits total) due to the physical nature of the card. What I don't understand is why they use 7 digits, when 6 was enough.

,

number

that

due to

they

There is likely an added check-sum for error detection.

Probably like this? 9 9 9 9 9 9 9 9 9 1001 1001 1001 1001 1001 1001 1001 1001 1001 Packed BCD 29 25 21 18 15 31 11101 11001 10101 10010 01111 11111 Base 32

just think of Hex. for example. 15 DEc is F (4 bits). so base 16 ( 16 different combo's) in every 4 bits = 2^4 so now do that for a base 32.. that is 5 bits. 32 numbers total. etc..

Yes, those are the same numbers that I got John.

But the result is only 6 digits, and they are already a 30-bit binary representation of 999999999, and no further processing is required to get the OP what he apparently wanted (just Shifts and Adds in a uP).

I was trying to find out what I was missing.

Someone has already suggested that the 7th digit is a checksum. This makes sense, possibly something like a simple XOR of the other 6.

Tony Williams.

Since he represented them as "digits" I had thought they were clumped in seven bit groups and perhaps he was asking about how to assemble them into bytes(?) to input to his µC. Maybe he'll post back with a clarification...

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required