author photo

November 28, 2008

Simon Fodden

The Friday Fillip

I had occasion to cancel a credit card and get a new one recently, which made me look at and think about credit card numbers. I suppose that I'd always thought of them as a more or less random string of integers, maximizing the number of such strings that would be available to banks etc. (10 X 10 X 10 etc. for each integer place…) and making it just that bit more difficult for criminals to suss out a number.

Turns out I couldn't be more wrong: credit card (and bank card) numbers are highly structured entities and only make use of "randomness" in a small way. They are governed by ISO 7812, which applies to magnetic stripe cards of all sorts.

The first regularity is the "major industry identifier," the first digit of the card number. 4 and 5 are reserved for the banking and financial industry. (1 is for airlines, 3 is for travel — which includes Amex — 7 is for petroleum…).

Then comes the 5 digit "issuer identifier number." In theory this is supposed to be secret, known only to those inside the industry. But as Wikipedia points out, it would be easy to gather examples from a number of cards and deduce a company's IIN.

Third is the card holder's account number, running from digit 7 to the next to the last digit, up to a maximum of 12 digits. This is the most nearly "random" part, but even here there is order, which is revealed by the…

Last digit, which is a "check digit." This end number is calculated by using the Luhn algorithm, also known as modulus 10. I am far too innumerate to give you the full mathematical model here. But the "simple" explanation runs as follows, and is taken directly from Wikipedia:

  1. Counting from rightmost digit (which is the check digit) and moving left, Double the value of every alternate digit. For any digits that thus become 10 or more, take the two numbers and add them together. For example, 1111 becomes 2121, while 8763 becomes 7733 (from 2×6=12 → 1+2=3 and 2×8=16 → 1+6=7).
  2. Add all these digits together. For example, if 1111 becomes 2121, then 2+1+2+1 is 6; and 8763 becomes 7733, so 7+7+3+3 is 20.
  3. If the total ends in 0 (put another way, if the total modulus 10 is congruent to 0), then the number is valid according to the Luhn formula; else it is not valid. So, 1111 is not valid (as shown above, it comes out to 6), while 8763 is valid (as shown above, it comes out to 20).

Now this isn't done, as you might suppose, as some sort of cryptographic effort at security; the real reason is to enable a check that in recounting the number none of the digits have been transposed. It would also, I guess, catch the odd fraudster who, like me, wouldn't be able to work the Luhn algorithm and come up with a valid-seeming account number.

Interestingly, the Luhn algorithm is also used to check transmitted Canadian social insurance numbers.

Simon Fodden is the founder of Slaw. He taught law at Osgoode Hall Law School for more than 30 years before he retired to focus on writing, publishing, and IT and law.
[click on the author's name for more information]

up

Comments are closed.

SlawTips      

SlawTips Top 10 Financial Errors: #9 Avoid Having a Written Office-Sharing or Partnership Agreement
Thursday, February 9

Max Amsterdam once said: “Business is the art of extracting money from another man’s pocket without resorting to violence.” The purpose of having a written agreement between all … »»

Practice

SlawTips Open Access Journals
Wednesday, February 8

There is good leagal content that doesn’t necessarily come in the neat packages that we usually look in.  Though our commercial legal database subscriptions have linked, vetted, edited, and easily. […] »»

Research

SlawTips Use join.me to Get on the Same Page Across the Web
Wednesday, February 8

When you need to collaborate on a document displayed on your screen, it’s great to have a colleague from down the hall come into your office and look over your … »»

Technology

noted on Slaw    

MLB Selected Case Summaries    

These summaries of selected recent cases are provided each week to Slaw by Maritime Law Book.
More information.

  • Banks and Banking - Liability of banks to third parties - Negligence - General

    The plaintiffs were the former shareholders of a company that failed. They sued the defendant bank alleging that it breached its contract with the company and the plaintiffs and breached a duty ...

  • Actions - Cause of action - General principles - New or extended cause of action - Opening of floodgates

    The plaintiff and defendant worked at different branches of the same bank. The defendant’s common-law husband was the plaintiff’s ex-husband. Over a four year period, the defendant ...

  • Aliens - Definitions and general principles - Immigration consultants

    The Canadian Society of Immigration Consultants (CSIC) had been designated as the sole regulatory body of immigration consultants in Canada from 2004 until June 2011. On June 30, 2011, Bill C-35 came into force, which significantly amended ...

  • Criminal Law - Sexual offences, public morals and disorderly conduct - Public morals - Obscenity - Possession of child pornography

    The accused was convicted of making child pornography available and two counts of possession of child pornography (see [2010] Sask.R. Uned. 197). Subsequently, he was sentenced ...

  • Criminal Law - Procedure - Charge or directions - Jury or judge alone - Directions regarding pleas or evidence of witnesses, co-accused and accomplices

    Rowe was convicted by a jury of five offences. He appealed.

    The Ontario Court of Appeal allowed ...

  • Narcotic Control - Offences - Possession - General

    The accused wished to access marijuana for medicinal purposes but did not have an authorization to possess marijuana issued under the Marihuana Medical Access Regulations. He was notified that a package of marihuana addressed to him had been ...

  • Narcotic Control - General - Legislation - Exemptions - Medicinal marijuana

    McCrady, who had an application pending under the Marihuana Medical Access Regulations (MMAR) to possess and grow marijuana, was convicted of possession of marijuana (Controlled Drugs and Substances Act (CDSA), s. 4(1)). Hearn pleaded guilty ...

  • Criminal Law - Sentence - Trafficking in hashish or marijuana (incl. possession for purposes of trafficking)

    The accused pleaded guilty to one count of possession of marijuana for the purpose of trafficking. He was sentenced to 30 days’ imprisonment to be served intermittently and 11 months’ ...

  • Municipal Law - Powers of municipalities - Particular powers - Imposition and collection of taxes or fees 

    Catalyst Paper Corp. operated a paper mill in the District of North Cowichan. Catalyst objected to the tax rate that it paid compared to residential ratepayers. In 2009, the ...


law foundation icon

The re-development
of Slaw is assisted by
a grant from the
Law Foundation of Ontario

TalkLaw/ParLoi    

This is a listing of a few upcoming events in Canada of interest to lawyers, law students, legal librarians, and others involved in the practice of law.

Clicking on any event in the list below will give you access to more information and to links allowing you to see the full entry and to add the event to your own calendar.

Click this link for a fuller version of the TalkLaw/ParLoi calendar of events and for instructions as to how to add events and calendars to your own calendar.

Switch to our mobile site