<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://leo.leung.xyz/wiki/index.php?action=history&amp;feed=atom&amp;title=Credit_Card_Number_Generator</id>
	<title>Credit Card Number Generator - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://leo.leung.xyz/wiki/index.php?action=history&amp;feed=atom&amp;title=Credit_Card_Number_Generator"/>
	<link rel="alternate" type="text/html" href="https://leo.leung.xyz/wiki/index.php?title=Credit_Card_Number_Generator&amp;action=history"/>
	<updated>2026-10-25T00:52:14Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://leo.leung.xyz/wiki/index.php?title=Credit_Card_Number_Generator&amp;diff=674&amp;oldid=prev</id>
		<title>Leo at 07:40, 27 January 2014</title>
		<link rel="alternate" type="text/html" href="https://leo.leung.xyz/wiki/index.php?title=Credit_Card_Number_Generator&amp;diff=674&amp;oldid=prev"/>
		<updated>2014-01-27T07:40:45Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 07:40, 27 January 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l3&quot;&gt;Line 3:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Different issuers/banks will use different prefixes. For instance, Visa will use values 40-49 while MasterCard uses 50-59. A complete list can be found on [http://en.wikipedia.org/wiki/List_of_Issuer_Identification_Numbers Wikipedia].&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Different issuers/banks will use different prefixes. For instance, Visa will use values 40-49 while MasterCard uses 50-59. A complete list can be found on [http://en.wikipedia.org/wiki/List_of_Issuer_Identification_Numbers Wikipedia].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== Code ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line start=&amp;quot;1&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line start=&amp;quot;1&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/usr/local/bin/python&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/usr/local/bin/python&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l21&quot;&gt;Line 21:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 22:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	for i in range(0, len(values)):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	for i in range(0, len(values)):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		values[i] = randint(0, 9)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		values[i] = randint(0, 9)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;		i = i + 1&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	return values&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	return values&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki:diff:1.41:old-673:rev-674:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Leo</name></author>
	</entry>
	<entry>
		<id>https://leo.leung.xyz/wiki/index.php?title=Credit_Card_Number_Generator&amp;diff=673&amp;oldid=prev</id>
		<title>Leo: Created page with &quot;I got bored one night and decided to create this as a quick exercise. This is a number generator that satisfies the luhn + MOD 10 algorithm that is used by credit card numbers...&quot;</title>
		<link rel="alternate" type="text/html" href="https://leo.leung.xyz/wiki/index.php?title=Credit_Card_Number_Generator&amp;diff=673&amp;oldid=prev"/>
		<updated>2014-01-27T07:39:07Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;I got bored one night and decided to create this as a quick exercise. This is a number generator that satisfies the luhn + MOD 10 algorithm that is used by credit card numbers...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;I got bored one night and decided to create this as a quick exercise. This is a number generator that satisfies the luhn + MOD 10 algorithm that is used by credit card numbers. &lt;br /&gt;
&lt;br /&gt;
Different issuers/banks will use different prefixes. For instance, Visa will use values 40-49 while MasterCard uses 50-59. A complete list can be found on [http://en.wikipedia.org/wiki/List_of_Issuer_Identification_Numbers Wikipedia].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line start=&amp;quot;1&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/local/bin/python&lt;br /&gt;
import sys&lt;br /&gt;
from random import randint&lt;br /&gt;
&lt;br /&gt;
def pad(prefix, values):&lt;br /&gt;
	prefix = str(prefix)&lt;br /&gt;
	i = 0&lt;br /&gt;
&lt;br /&gt;
	for c in prefix:&lt;br /&gt;
		values[i] = int(c)&lt;br /&gt;
		i = i + 1&lt;br /&gt;
&lt;br /&gt;
	return values&lt;br /&gt;
&lt;br /&gt;
def randomize(values):&lt;br /&gt;
	for i in range(0, len(values)):&lt;br /&gt;
		values[i] = randint(0, 9)&lt;br /&gt;
		i = i + 1&lt;br /&gt;
&lt;br /&gt;
	return values&lt;br /&gt;
&lt;br /&gt;
def luhn_value(values):&lt;br /&gt;
	sum = 0&lt;br /&gt;
	i = 0&lt;br /&gt;
&lt;br /&gt;
	while i &amp;lt; len(values):&lt;br /&gt;
		if i % 2 == 0:&lt;br /&gt;
			value = values[i] * 2&lt;br /&gt;
&lt;br /&gt;
			# Since doubling a single value results in 2 &amp;lt;= i &amp;lt;= 18&lt;br /&gt;
			# the sum of the digits is equivolant to subtracting 9&lt;br /&gt;
			if value &amp;gt;= 10:&lt;br /&gt;
				value = value - 9&lt;br /&gt;
		else:&lt;br /&gt;
			value = values[i]&lt;br /&gt;
&lt;br /&gt;
		sum = sum + value&lt;br /&gt;
		i = i + 1&lt;br /&gt;
&lt;br /&gt;
	return (sum * 9) % 10&lt;br /&gt;
&lt;br /&gt;
def generate(prefix = &amp;quot;&amp;quot;):&lt;br /&gt;
	length = 15&lt;br /&gt;
	values = [0]*length&lt;br /&gt;
	prefix = str(prefix)&lt;br /&gt;
&lt;br /&gt;
	values = randomize(values)&lt;br /&gt;
	values = pad(prefix, values)&lt;br /&gt;
	check = luhn_value(values)&lt;br /&gt;
&lt;br /&gt;
	return &amp;quot;&amp;quot;.join(str(n) for n in values) + str(check)&lt;br /&gt;
	&lt;br /&gt;
if len(sys.argv) == 2:&lt;br /&gt;
	if sys.argv[1].isdigit():&lt;br /&gt;
		print(generate(sys.argv[1]))&lt;br /&gt;
	else:&lt;br /&gt;
		print(&amp;quot;Usage: cc.py [prefix]&amp;quot;)&lt;br /&gt;
else:&lt;br /&gt;
	print(generate())&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
 python cc.py 45&lt;br /&gt;
 4539371684142703&lt;br /&gt;
&lt;br /&gt;
 python cc.py  55&lt;br /&gt;
 5555576731917875&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Python]]&lt;/div&gt;</summary>
		<author><name>Leo</name></author>
	</entry>
</feed>