<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/1.5.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
	<title>Acme Technologies Zeitgeist</title>
	<link>http://www.acmetech.com/blog</link>
	<description>Daily Diversions in Technology</description>
	<pubDate>Wed, 29 Aug 2007 18:49:44 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5.2</generator>
	<language>en</language>

		<item>
		<title>Magnetic Track Data Parsers</title>
		<link>http://www.acmetech.com/blog/magnetic-track-data-parsers/</link>
		<comments>http://www.acmetech.com/blog/magnetic-track-data-parsers/#comments</comments>
		<pubDate>Thu, 24 Mar 2005 03:56:59 +0000</pubDate>
		<dc:creator>wayne</dc:creator>
		
	<category>Filemaker Pro</category>
		<guid>http://www.acmetech.com/blog/magnetic-track-data-parsers/</guid>
		<description><![CDATA[	
	Parsing Mag Stripe Track Data
	I had to write some code to parse mag stripe track data (as found on credit and debit cards) recently, and since pre-written parsers in Java and JavaScript were not easy to locate, I&#8217;m making mine available here. For more information on Track 1 and Track 2 data, please see the [...]]]></description>
			<content:encoded><![CDATA[	<p><!--adsense#rectangle--></p>
	<h2>Parsing Mag Stripe Track Data</h2>
	<p>I had to write some code to parse mag stripe track data (as found on credit and debit cards) recently, and since pre-written parsers in Java and JavaScript were not easy to locate, I&#8217;m making mine available here. For more information on Track 1 and Track 2 data, please see the background document: <a href="http://www.acmetech.com/documentation/credit_cards/magstripe_track_format.html" title="Format of magnetic track 1 and track 2 data">Magnetic Stripe Track 1, Track 2 Data Description</a>.</p>
	<h3>Parsing Magnetic Track Data in Java</h3>
	<p>The CreditCardUtils.jar file contains Java classes for parsing magnetic track data (tracks 1 and 2), validating credit card account numbers (LUHN checksum) and determining the type of credit card (e.g., AmEx, Visa, MasterCard, Discover, etc.).</p>
	<ul>
	<li>View the JavaDocs for the <a href="http://www.acmetech.com/documentation/java/credit_card_utils/" title="Credit Card Utils Java Documentation" target="external">credit card validation and parsing utilities</a></li>
	<li>Download the <a href="http://software.acmetech.com/java/CreditCardUtils_0.1.zip" title="Download Credit Card Java Utils" onClick="javascript:urchinTracker ('/downloads/JavaCreditCardUtils');">CreditCardUtils.jar</a></li>
	</ul>
	<p>The java archive contains the following classes:</p>
	<blockquote>
	<ul>
<li>com/acmetech/cc/CreditCardInfo.java</li>
	<li>com/acmetech/cc/MagStripeCard.java</li>
	<li>com/acmetech/cc/MagstripeParseException.java</li>
	</ul></blockquote>
	<p>
The track data parser accepts as input, track 1 (with or without sentinels), track 2 (with or without sentinels) or combined Track 1 and Track 2 strings. It will canonicalize the input track data, optionally auto-generate Track 2 string data when only Track 1 is provided, and offers functions for obtaining raw tracks, account holder name, expiration date, and primary account number.
</p>
	<h3>Parsing Mag Stripe Track Data in JavaScript</h3>
	<p>I&#8217;ve cobled together a JavaScript object from sources found at www.skipjack.com for parsing magnetic track data. Usage involves first creating a new object seeded with your track data:<br />
<code>
<pre>
	var track = &quot;%B1234123412341234^Carduser/John^&quot;;
	track += &quot;030510100000019301000000877000000?&quot;;
	track += &quot;;1234123412341234=0305101193010877?&quot;;
	var p = new SwipeParserObj(track);
</pre>
</code></p>
	<p>To view the parsed fields, use the dump() function of the object:<br />
<code>
<pre>
	p.dump();  -- returns parsed field values and meta info.
</pre>
</code></p>
	<p>&#8211; or &#8211;</p>
	<p>get individual field names (see member variables at top of <a href="/documentation/javascript/parse_magnetic_track_javascript.html" title="JavaScript magstripe track parser">MyMagstripeParser</a> object definition):</p>
	<p><code>
<pre>
	if( p.hasTrack1 ){
		p.surname;
		p.firstname;
		p.account;
		p.exp_month + \"/\" + p.exp_year;
	}
</pre>
</code></p>
	<p><a href="/documentation/javascript/parse_magnetic_track_javascript.html" title="JavaScript parser for magnetic track 1 and 2 data">View or Download JavaScript Track 1 and 2 Parser</a></p>
	<p>
When I get more time, I&#8217;ll create an online form for testing these functions. For now that exercise is left to the reader.
</p>
	<p><!--adsense-->
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.acmetech.com/blog/magnetic-track-data-parsers/feed/</wfw:commentRSS>
	</item>
	</channel>
</rss>
