﻿[Script Info] Title: [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:00:00.00,0:00:04.00,Default,,0000,0000,0000,,Now what we do is we sum up all of these digits that we've derived at--that is to say Dialogue: 0,0:00:04.00,0:00:07.00,Default,,0000,0000,0000,,the odd number of digits we just summed up, the even number of digits we summed up, Dialogue: 0,0:00:07.00,0:00:11.00,Default,,0000,0000,0000,,the results of these calculations, and then we compute the value Mod 10--that is to say Dialogue: 0,0:00:11.00,0:00:17.00,Default,,0000,0000,0000,,we just took the 1s digit of the sum and if that value was equal to 0, you have a valid credit number. Dialogue: 0,0:00:17.00,0:00:20.00,Default,,0000,0000,0000,,If the value does not come out to be 0, then it's invalid. Dialogue: 0,0:00:20.00,0:00:23.00,Default,,0000,0000,0000,,Okay. So that was the case for the odd number of digits. Dialogue: 0,0:00:23.00,0:00:26.00,Default,,0000,0000,0000,,Now, let's briefly look at the case for an even number of digits and that's almost the same. Dialogue: 0,0:00:26.00,0:00:29.00,Default,,0000,0000,0000,,So if we have an even number of digits, we go ahead and take Dialogue: 0,0:00:29.00,0:00:31.00,Default,,0000,0000,0000,,the odd number of digits, double them, and we'll try it now.. Dialogue: 0,0:00:31.00,0:00:35.00,Default,,0000,0000,0000,,If the doubled number ends up being 10 or higher, then after that the process is the same. Dialogue: 0,0:00:35.00,0:00:40.00,Default,,0000,0000,0000,,We add them up, take the 1s digit or equivalently take the sum Mod 10 and see if the result is 0. Dialogue: 0,0:00:40.00,0:00:44.00,Default,,0000,0000,0000,,So that is Luhn's algorithm, and the reason that we need to go over that in a bit of painstaking detail Dialogue: 0,0:00:44.00,0:00:48.00,Default,,0000,0000,0000,,is because if you want to generate valid credit car numbers, then you're going to need to implement Dialogue: 0,0:00:48.00,0:00:51.00,Default,,0000,0000,0000,,Luhn's algorithm in order to do that, and so there's one little detail that I left off. Dialogue: 0,0:00:51.00,0:00:54.00,Default,,0000,0000,0000,,And so what I just told you is way to check whether the number is valid Dialogue: 0,0:00:54.00,0:00:57.00,Default,,0000,0000,0000,,and what you're going to need to do is create a valid credit card number. Dialogue: 0,0:00:57.00,0:01:00.00,Default,,0000,0000,0000,,So you're going to be given the issue identifier, you're going to make up the account number Dialogue: 0,0:01:00.00,0:01:04.00,Default,,0000,0000,0000,,randomly, and then what you're going to do is put a 0 at the end of the credit card number, Dialogue: 0,0:01:04.00,0:01:10.00,Default,,0000,0000,0000,,use Luhn's algorithm to compute the check sum for it and the result of that is unlikely to be 0. Dialogue: 0,0:01:10.00,0:01:14.00,Default,,0000,0000,0000,,If the check sum comes out to be 0, then you've already generated a valid credit number. Dialogue: 0,0:01:14.00,0:01:18.00,Default,,0000,0000,0000,,If it hasn't, then you're going to have to take 10 to track the check sum from 10 Dialogue: 0,0:01:18.00,0:01:21.00,Default,,0000,0000,0000,,and put whatever number you arrived at in the place of the check sum digit where you had 0 Dialogue: 0,0:01:21.00,0:01:25.00,Default,,0000,0000,0000,,and now you have a valid credit card number, and I suggest that as you're implementing this Dialogue: 0,0:01:25.00,0:01:27.00,Default,,0000,0000,0000,,you check it--so you compute the Luhn number. Dialogue: 0,0:01:27.00,0:01:32.00,Default,,0000,0000,0000,,If it's not 0, you subtract it from 10, put that in the check sum position, and now you can go ahead Dialogue: 0,0:01:32.00,0:01:38.00,Default,,0000,0000,0000,,and compute the check sum of the entire credit card number--it need to come out 0