BBB SPAM Dissection

This spam appears to be nothing more than a link to a defaced website.  The source code contains a whole bunch of links to the hacker and his group, including a website and even a Facebook page.  This looks to me like the malicious hacker equivalent of a resume.  People looking to hire a script-kiddie can reach Mr. Black-King through the links contained in the file.  They'd probably be better off hiring somebody else.  His code was full of typos.

Spam includes:  Jquery, YUI, and a bunch of other formatting files.  

Source code from BBB SPAM link:

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<html xmlns="http://www.w3.org/1999/xhtml">
     
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <head>
     <link rel="SHORTCUT ICON" 
href="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcS50z5gHEhc2MDqtqeAD-rCJjpW87x87ugCXHONBiLajizZcpkljw" type="image/png" rel="icon">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title></title>
    <script type="text/javascript">
function tb8_makeArray(n){
this.length = n;
return this.length;
}
tb8_messages = new tb8_makeArray(3);
tb8_messages[0] = "Hacked By Black-King";
tb8_messages[1] = "TURK HACK TEAM.Net /Black-King";
tb8_messages[2] = "Zaman Doldu..!";
tb8_rptType = 'infinite';
tb8_rptNbr = 5;
tb8_speed = 100;
tb8_delay = 2000;
var tb8_counter=1;
var tb8_currMsg=0;
var tb8_tekst ="";
var tb8_i=0;
var tb8_TID = null;
function tb8_pisi(){
tb8_tekst = tb8_tekst + tb8_messages[tb8_currMsg].substring(tb8_i, tb8_i+1);
document.title = tb8_tekst;
tb8_sp=tb8_speed;
tb8_i++;
if (tb8_i==tb8_messages[tb8_currMsg].length){
tb8_currMsg++; tb8_i=0; tb8_tekst="";tb8_sp=tb8_delay;
}
if (tb8_currMsg == tb8_messages.length){
if ((tb8_rptType == 'finite') && (tb8_counter==tb8_rptNbr)){
clearTimeout(tb8_TID);
return;
}
tb8_counter++;
tb8_currMsg = 0;
}
tb8_TID = setTimeout("tb8_pisi()", tb8_sp);
}
tb8_pisi()
</script>
    <style type="text/css">body, a, a:hover {cursor: 
url(http://hellox.persiangig.com/DefacePage/negro.cur), progress;}</style>
    <!-- CSS -->
    <link rel="stylesheet" type="text/css" 
href="http://hellox.persiangig.com/DefacePage/jquery00.css" media="all">
    <link rel="stylesheet" type="text/css" 
href="http://hellox.persiangig.com/DefacePage/prettyPh.css" media="all">
    <link rel="stylesheet" type="text/css" 
href="http://hellox.persiangig.com/DefacePage/style000.css" media="all">
     
     
     
    <script type="text/javascript" 
src="http://hellox.persiangig.com/DefacePage/jquery-1.js"></script>
    <script type="text/javascript" 
src="http://hellox.persiangig.com/DefacePage/cufon-yu.js"></script>
    <script type="text/javascript" 
src="http://hellox.persiangig.com/DefacePage/Yanone_K.js"></script>
    <script type="text/javascript" 
src="http://hellox.persiangig.com/DefacePage/jquery00.js"></script>
    <script type="text/javascript" 
src="http://hellox.persiangig.com/DefacePage/jquery01.js"></script>
    <script type="text/javascript" 
src="http://hellox.persiangig.com/DefacePage/jquery02.js"></script>
    <script type="text/javascript" 
src="http://hellox.persiangig.com/DefacePage/jquery03.js"></script>
    <script type="text/javascript" 
src="http://hellox.persiangig.com/DefacePage/jquery04.js"></script>
    <script type="text/javascript" 
src="http://hellox.persiangig.com/DefacePage/jquery05.js"></script>
    <script type="text/javascript" 
src="http://hellox.persiangig.com/DefacePage/jquery06.js"></script>
    <script type="text/javascript" 
src="http://hellox.persiangig.com/DefacePage/jquery07.js"></script>
    <script type="text/javascript" 
src="http://hellox.persiangig.com/DefacePage/custom00.js"></script>
    <script type="text/javascript">
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-20402842-6']);
      _gaq.push(['_trackPageview']);
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; 
ga.async = true;
        ga.src ='http://hellox.persiangig.com/DefacePage/ga.js';
        var s = document.getElementsByTagName('script')[0]; 
s.parentNode.insertBefore(ga, s);
      })();
    </script><script language="JavaScript" type="text/javascript">
    mensaje = '*<--Hacked by Black-King -->*';font = 'arial';size = 2.5;color = 
'#00FF00';velocidad = 0.6;
    n4 = (document.layers);ie = (document.all);n6 = (document.getElementById);
    mensaje = mensaje.split('');n = mensaje.length;
    a = size*10;ymouse = 0;xmouse = 0;props = "<font face="+font+" color="+color+" 
size="+size+">";
    if (n4){for ( i = 0; i < n; i++)document.write('<layer left="0" top="0" 
width="+a+" name="n4mensaje'+i+'" height="+a+"><center>'+props+mensaje[i]+'</font>
</center></layer>');}else if (ie){document.write('<div id="padre" 
style="position:absolute;top:0px;left:0px"><div style="position:relative">');for 
(i=0; i < n; i++)document.write('<div id="iemensaje" 
style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-
align:center">'+props+mensaje[i]+'</font></div>');document.write('</div>
</div>');}else if (n6){document.write('<div id="padre" 
style="position:absolute;top:0px;left:0px"><div style="position:relative">');for (i = 
0; i < n; i++)document.write('<div id="iemensaje'+i+'" 
style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-
align:center">'+props+mensaje[i]+'</font></div>');document.write('</div></div>');}
    if(n4)window.captureEvents(Event.MOUSEMOVE);
    function Mouse(evento){ if(ie){xmouse = event.x+20;ymouse = event.y+20;}else 
if(n4 || n6){xmouse = evento.pageX+20;ymouse = evento.pageY+20;}}
    if(n4)window.onMouseMove = Mouseelse if(ie || n6)document.onmousemove = Mouse;
    y = new Array();x = new Array();Y = new Array();X = new Array();Yaux = new 
Array();Xaux = new Array();
    for (i=0; i < n; i++){y[i] = 0;x[i] = 0;Y[i] = 0;X[i] = 0;Yaux[i] = 0;Xaux[i] = 
0;}
    function asigna(){if (ie)padre.style.top = document.body.scrollTop;
    for (i = 0; i < n; i++){if(n4){document.layers['n4mensaje'+i].top = 
y[i];document.layers['n4mensaje'+i].left = x[i]+(i*(a/2));}else if(ie)
{iemensaje[i].style.top = y[i];iemensaje[i].style.left = x[i]+(i*(a/2));}else if(n6)
{eval("document.getElementById('iemensaje"+i+"').style.top = 
'"+y[i]+"px'");eval("document.getElementById('iemensaje"+i+"').style.left = '"+(x[i]+
(i*(a/2)))+"px'");} }}
    function ondula(){y[0]=Math.round(Y[0] +=((ymouse)-
Y[0])*velocidad);x[0]=Math.round(X[0] +=((xmouse)-X[0])*velocidad);
    for (var i = 1; i < n; i++){Yaux[i] = Math.round(Y[i]);Xaux[i ]= 
Math.round(X[i]);y[i] = Math.round(Y[i]=Yaux[i]+(y[i-1]-Y[i])*velocidad);x[i] = 
Math.round(X[i]=Xaux[i]+(x[i-1]-
X[i])*velocidad);}asigna();setTimeout('ondula()',50);}
    window.onload = ondula;
    </script>
    </head>
    <body onload="teclear();" oncontextmenu="return false;" onkeydown="return false;" 
onmousedown="return false;">

        <!-- wrappage begin here -->
        <div id="wrappage">
            <!-- container begin here -->

            <div class="container">
                <!-- top block begin here -->
</br>
                             <div class="top">

                 <div class="energy"></div>
                    <div class="top-block">
                        
                    <a class="logo"><font size="15">TURK HACK TEAM</font></a>
                        <div class="bg-e-button"></div>

                         <a href class="open"><img 
src="http://hellox.persiangig.com/DefacePage/flash000.png" alt=""></a>

                        </div>

                </div>

                <!-- top block end here -->
                <!-- center block begin here -->
                <div class="center-block">
                 <!-- &#199;&#211;&#732;&#228;&#209; -->
                 <div class="scanner clearfix">
                  <div class="scanner-block">

                   <div class="scanner-box left">
                    <div class="scanner-line"></div>
                   </div>
                   <ul class="data left">
                    <li class="search">Lutfen Bekleyiniz Sistem Yukleniyor.. </li>
                   </ul>
                               </div>
                 </div>
                    <!-- &#200;&#206;&#212; &#199;&#213;&#225;&#237; -->
                    <div class="main">
                     <div class="load"></div>
                     <div class="shut-left"></div>
                     <div class="shut-right"></div>
                      <div class="page">
                        <div class="box-left left">
                         <div class="info">
                           <ul class="socicon left">
                                               <img src="http://www.turkhackteam.net/customavatars/avatar656657_18.gif" width="100%" 
alt="DotMy" class="right"><center><object type="application/x-shockwave-flash" 
data="http://flash-mp3-player.net/medias/player_mp3_mini.swf" height="20" 
width="200">       <param name="movie" value="http://flash-mp3-
    player.net/medias/player_mp3_mini.swf"> <param name="bgcolor" value="#000000">  
<param name="FlashVars" value="mp3=http://punjabimob.org/downloads-
    11/load/Alphabetical_Hindi_Movies/Alphabet_R/Rang_De_Basanti_
    -_2006/09_-_Rang_De_Basanti_-_Lalkaar_-_
    (PunjabiMob.Com).mp3&amp;autoplay=1&amp;loadingcolor=000000&amp;a
    mp;slidercolo">ee></object></center></br></br >
                    
     
                           </div>
                            <ul id="menu" class="right">
                                <li>
                                  <a href="#msg" class="selected">Duyurum</a>
                                                                   <a href="#about"
     

class="selected">Hakkimda</a>
                                                             
                                </li>
                              </ul>

                        </div>
     


                            <div class="cont left">
                            <!-- &#227;&#228;&#230;&#229;&#199; -->
                                <div id="msg" class="box left">
                                            <div class="box-content">
                                            <h3><font color="green">TurkHackTeam.Net</font></h3>
                                            
                                            <p class="sub"><font color="#800000">TURKHACKTEAM - Black-King</font></p>
     
                                            
                                            <p><strong><font color="white">Merhaba Sayin Admin. TurkHackerTeam Black-King Tarafindan Hacklandiniz.
Sisteminizi Elegecirmeyi istemedim. Ama Buna Mecburdum. Ya Ben Bu Yanlis Giden Dunya Duzenine Dur Diyecegim.
Yada Dunya Oldugu Gibi Kotuluge Baticakti.
Evet Dunya Barisini istiyoruz.
Biz Bunu Sanalda Sagliyoruz.
Ama Reel icinde Ugrasiyoruz
Amacimiz Pisikolojik Savas Yaratmaktir. Bu Savasi Turkler Kazanacaktir...
Cunki Biz Sanal Alemin krallariyiz. Bunu Herkez Bilir.
<font color="red"><center>By Selam Heke Devam...</center></font>
 </font></strong></p>
                                            
<p>==================================================================================
</p>
                                           
                                            
                                       <center>     <p><strong><font color="red">www.turkhackteam.net /org bekleniyorsunuz. /Black-King/.</font></strong></p> </center>
                                            
<p>==================================================================================

<b><p><strong><font color="white">Biz Kimmiyiz ?  iste Bizim Listemiz
ZoRRoKiN-Elazigli168-3333-Bedros Sanches
Black-Box-Genghis Khan-SaMuRai-NightWolf-Ra's al Ghul
secWorm-_EroS_ -INFeRNaL-DelPhoi
'Ghost Warrior-Solo-Turk-SaLii-_RoC_
Black-King
Daha Fazlasi icin TurkHackTeam.Net </center>  </font></strong></p></b>


</p>
                                            </div>
                    </div>
                                   
                                   
                    <div id="sysinfo" class="box left">
                                            <div class="box-content">
                                            <h3><font color="red">System Info</font>
</h3>
                                            <p class="sub"><font 
color="#42413E">Server Kernel</font></p>
                                           
                                            <strong><font color="gold">Linux 
macan.fastnsecure.net 2.6.18-408.el5.lve0.8.58 #1 SMP Wed Mar 14 14:10:01 EDT 2012 
x86_64</font></strong></br>
                                           
                                            </div>
                    </div>
                                   
                                   
                                    <div id="about" class="box left">
                                            <div class="box-content">
                                            <center><h3><font color="red">Black-King Hakkinda !</font></h3>
                                            <p class="sub"><font color="gold">Www.TurkHackTeam.Net / Org 
kamkam50-turkhackteam.blogspot.com
www.facebook.com/TurkHackTeamKamKam
Ziyaretimize Bekleriz.
Hakkimizda Olan Sorularinizi Bana Degil , cevreme soracaksiniz.
Coded By Black-King </font></p>
                                           
                                            <strong><font color="red"> 
</font></strong></br>
                                            <p><strong><font color="white"></font></strong></p>
    
     
                                           
                                           
                                            <strong><font color="red">TurkHackTeam Yöneticileri

<p>==================================================================================

<b><p><strong><font color="white">Biz Kimmiyiz ?  iste Bizim Listemiz
ZoRRoKiN-Elazigli168-3333-Bedros Sanches
Black-Box-Genghis Khan-SaMuRai-NightWolf-Ra's al Ghul
secWorm-_EroS_ -INFeRNaL-DelPhoi
'Ghost Warrior-Solo-Turk-SaLii-_RoC_
Black-King
Daha Fazlasi icin TurkHackTeam.Net </center>  </font></strong></p></b>


</p>


</font></strong></center></br>
                                            <p><strong><marquee direction="left" 
scrollamount="5" scrolldelay="100" width="100%"><font color="#00FF00"> Hacked By Black-King TurkHackTeam.Net </font></marquee></strong></p>
                                                                   
                                            </div>
                    </div>
                                   
                                    <div id="music" class="box left">
                                            <div class="box-content">
                                            <h3><font color="red">Muzik</font>
</h3>
                                            <p class="sub"><font color="#42413E">Müzik</font></p>
                                           
                                            <strong><font color="green">In the End - 
Linkin Park</font></strong></br>
                                            </div>
                    </div>
                                   
     
                    <div id="irc" class="box left">
                                <div class="box-content">
                                </div>
                            </div>
                        </div>
                      </div>
                    </div>
                </div>
                <div class="bottom">
                    <div class="bottom-block">
                        <h4class="left">Hacked by Black-King</h4>
                    </div>
                </div>
            </div>
        </div>
<pre><embed src="http://www.youtube.com/v/gg9hcNObRP8&amp;autoplay=1" 
type="application/x-shockwave-flash" loop="true" wmode="transparent" width="1" 
height="1" __idm_id__="-1582612479" ></pre>
<pre><embed src="http://www.youtube.com/v/rqbwiLY277I&amp;autoplay=1" 
type="application/x-shockwave-flash" loop="true" wmode="transparent" width="1" 
height="1" __idm_id__="-1582612479" ></pre>
 </body>
    </html>
This logo gets pulled down from a google (gstatic) server.  Virustotal.com doesn't think it's malicious.  It's just a hacker logo.

This logo gets pulled down from a google (gstatic) server.  Virustotal.com doesn't think it's malicious.  It's just a hacker logo.

Poor Man's Password Vault

DSCN7411a.JPG

The idea of a simulated USB keyboard captured my immagination back when I first learned about the Yubikey.  The web based authentication service was never very compelling.  But the idea of instantly typing a ridiculously long password is downright cool.  It was so cool, I bought one that very day.  

Unfortunately, the Linux based Yubico tools didn't live up to my expectations.  I was able to get a static password entered, but the tools felt half done and I felt like I was going to brick my $30 toy the next time a bug cropped up.  Added to that, the device didn't quite fill a USB port and quickly stopped working correctly - the very light pressure from the touch sensor was often enough to disconnect the USB.  Finally, after only a few months on my key chain the device died all together.

Enter the Digispark.  I learned that this tiny gem (an Arduino compatible microprocessor) can emulate a USB keyboard.  And it costs $9.  That's nine bucks - lunch money!  The Arduino IDE is intuitive and has extensive sample code.  Here was the code for my "poor man's static password Yubikey."

#include "DigiKeyboard.h"

void setup() {
pinMode(0, OUTPUT); //Convenient Voltage Source
pinMode(1, OUTPUT); //Blinky LED
pinMode(2, INPUT); //Button Input
digitalWrite(0,HIGH); //Turn on the source
}

void loop() {
DigiKeyboard.sendKeyStroke(0);
digitalWrite(1, LOW); //Blink a few times
DigiKeyboard.delay(250);
digitalWrite(1, HIGH);
DigiKeyboard.delay(250);
digitalWrite(1, LOW);
DigiKeyboard.delay(250);
digitalWrite(1, HIGH);
DigiKeyboard.delay(250);
if(digitalRead(2)==HIGH){//check multiple times to debounce
if(digitalRead(2)==HIGH){
if(digitalRead(2)==HIGH) DigiKeyboard.println("Some Really random password!");
}
digitalWrite(0,LOW); //Make sure we don't trigger twice
DigiKeyboard.delay(2000);
digitalWrite(0,HIGH);

}
}
DSCN7418a.JPG

The program is dirt simple.  It spits out a string when the input goes high.  It looks a bit more complicated because I'm blinking an LED just for fun and adding a few lines to clear the input to prevent multiple triggers.  

I initially had a physical button soldered between 0 and 2 (pin 1 is connected to an LED and the switch I had was just wide enough to span between 0 and 2).  I discovered I was triggering the text before I pushed the button.  My skin was conductive enough to complete circuit via the solder bumps.  So I removed the physical button and added some generous solder bumps.  It works just fine with no physical button.  

 Obligatory Shot with a Quarter

To make it more robust in my pocket, I encased the whole thing in two part epoxy.  I was careful to leave the solder bumps exposed and of course the USB leads.  A second layer of epoxy attached the solder braid for an attracive key ring.

It works and it cost $9.  Add in some gently used solder braid and some 5 minute epoxy and you have a $10 password storage key.

Update: 

I didn't intend this to be a negative review of Yubikey, but it certainly read that way.  A few days after I wrote this article, Yubico contacted me and sent me a replacement key.  I didn't want to immediately retract what I said about the Yubikey, but thought I'd stick it on my key chain and see how the new one held up.  I'm happy to say the new key works great and has ever since I got it.  It's obviously been through a redesign and the thicker end stays in a USB port better.   Moreover, the software tools have come a long way and are about as professional as anything I have seen.  They worked equally well in Windows and Linux.

I'm experiencing none of the flakiness I mentioned before.  I have two static passwords programmed into it which is my preferred use case.  I easily update them every 30 days when my employer makes me change to a new impossible-to-remember password.  It even works through an OTG cable so I can update my stored credentials on my smart phone without typing all those special characters on a touch keyboard.  (My Digispark also works through the OTG cable but not everything does.) 

All-in-all, I'd say my new experience has been entirely positive and the price was right.  Even at $25 I'd say the Yubikey is a nice cheap physical password vault.

 

How to Wire an AC Induction Motor.

I've never seen a good explanation about how to hook up an AC motor.  All the explanations are different and they all over-complicate the matter.  There are 2 coils of copper wire and they both get hooked up to the AC current.  You add a capacitor to in series with one coil to get the motor to turn.  Hot and common don't matter - you're hooking them together with a long coil of wire.

Basic AC Motor Circuit

Well fear not!  All you need to figure it out is the face plate, the appropriate capacitor, and a cheap multimeter.  Using this method, you should be able to wire up any single phase 100/120 VAC 50/60 Hz motor regardless of the wiring configuration.  The face plate will tell you what size capacitor you need.  

If there are two capacitors required, the face plate will list both.  Also there is often a great big hump where the capacitors get mounted.  In this case, the capacitor wires will likely be routed to the capacitors already.  If the capacitor is already hooked up, you may not be able to find both sides of both coils.  One of the coils will already be hooked to the capacitor in series and will have a high resistance.  You can verify that one side of the capacitor is attached to a coil of you have access to the leads.

3 WIRES

If you're lucky, there are 3 leads.  In this case, all three wires are connected to each other with different resistances between them.  Find the pair with the highest resistance between them and connect those two wires to the capacitor.  The third wire goes to one leg of the AC (either hot or common it doesn't matter)  The other leg of the AC should go on one side of the capacitor.  That's it for the 3 wire setup. Switch the side of the capacitor to reverse directions.

4 WIRES

With four wires, you may have access to both sides of each coil.  You should have two pairs of wires each attached by a coil with a corresponding resistance.  In my case, with a tiny 1/50 HP motor, I had one coil which measured 70 ohms and one was 120 ohms.  Tie one side of each pair together and connect that to the AC.  Tie the other two ends to the capacitor.  Attach the other leg of the AC to either side of the capacitor.

Another possibility with four wires is that two wires will be tied together with almost no resistance.  In this case (ignoring one of the pair for the moment) you have a three wire setup.  The second wire is for temporarily attaching a second start capacitor.  This start capacitor typically goes in parallel with the the other capacitor to increase the starting torque.  Some, especially larger, motors will have both a start capacitor and a run capacitor.  The start capacitor can be removed manually, or may have a speed switch that automatically disconnects it.

5 OR MORE

If you have 5 or more wires, then likely one or more pairs are connected internally or you don have extra built-in accessories such as a clutch or brake.  There should be some mention of extra parts on the face plate.  Also, the clutch or brake are usually removable or at the very least are manufactured separately and should be obvious.  The motor will look too long.  You should still be able to identify the two coils with a volt meter, tie two ends together, and tie the other two ends to the capacitor.    

A good final check is to measure the resistance across the power leads BEFORE YOU PLUG IT IN.  If you have zero resistance, don't plug it in.  Bad things happen and typically the lights go out after some sparks fly...  Your two coils are in parallel now and resistors in parallel add according to the rule:

reciprocals add.png

You can reverse the direction by switching the side of the capacitor that gets a power lead.  (Swapping the power leads with each other doesn't do anything.)  You shouldn't try to switch directions with the motor spinning.  Again, this typically leads to spark, but not from the wall.  You'll likely fry whatever switch you're using to switch directions.  I learned that one the hard way.

CONCLUSION

Go forth and spin AC motors!  Find the end of each coil with a multimeter, connect one side of each coil to the power and the other side to the capacitor.  Connect the other side of the AC to one side of the capacitor.  Hot and common don't matter at all.

Don't work on the motor with the power connected!  Be careful with the capacitor.  A small one probably won't kill you if you accidentally discharge it, but they hurt.  Check the resistance between the AC leads before you plug it in.  Shorting the AC is a bad thing.

AES in LabVIEW

The AES standard has become synonymous with state-of-the-art encryption. The AES (Rijndael) cipher is specified in NIST FIPS-197.  I decided to implement the cipher in LabVIEW, my favorite programming language.  All code was written from scratch from the specification. In addition, the first four encryption modes in NIST SB 800-38A were implemented. Electronic Code Book (ECB), Cipher Block Chaining (CBC), Cipher Feedback (CFB), and Output Feedback (OFB) are included and work. The programs pass all test vectors listed for the included modes.

Two simple utilities can be found in the Tools section which demonstrate the AES standard implemented in LabVIEW. The first encrypts a given file and saves it with an ".encr" extension. The second decrypts and (by default) strips off the last extension. The default key is from the spec so I don't suggest using it. It's a perfectly good key, just easy to guess. I wont promise these programs are secure against all attacks, but they do work.

Don't forget your key! The utility doesn't remember it. It's a feature not a bug. I suggest you write it down and store it on a safe place. You'll need to download and install a recent LabVIEW runtime engine to make these work.

Update:  We have added an installer which includes the Labview 2012 runtime.  We're sorry the runtime is such a beast.  This way you will not have to create a (free) NI account to try these out!

Encryption Utility

Decryption Utility

Encrypt a File

Decrypt a File

New!  Installer with Labview 2012 Runtime

Various Papers and Presentations

Recent papers and presentations can be found in the "Papers" menu.  There are a wide variety of topics and some of the presentations were particularly informal.

Four of the papers were academic papers published with Singh Brar of UDRI and Vassant Joshi from the Navy.  They involved the development of Johnson-Cook (JC) model constants.  The JC model is divided into a strength model and a fracture model.  The strength model tries to capture the effect of temperature, strain rate, and stress triaxiality on the strength of a material.  The fracture model tries to capture these same parameters' effects on the strain to failure.

One short academic paper on an optical extensometer concept was a final project report for an electro-optics lab course.  The concept worked and we all got A's if I recall correctly.  

The final academic paper was a discussion of Avionics Full Duplex (AFDX), which is basically ethernet for airplanes.  It is used on big jumbo jets for non critical functions, but was designed for handling important bits.  This paper discusses how might fare against other flight-critical bus choices.

The presentations, U3 Hacking, Firesheep on Linux, and the Euler Project were delivered at the local Dayton Microcomputer Association Linux User Group and/or the local Python User Group.  

MD5sum Tools

An MD5sum is a quick way to verify whether or not a file has changed.  It's known as a Hash function.  A hash function takes in any length of data, mixes it all up and spits out an unique string called a hash.  Any small change in the input file is supposed to vastly change the hash which allows one to quickly verify that the same data was read twice.

It's not considered a secure hash, because it is feasible to intentionally create a given hash if you try hard enough.  This is a bad thing when looking for intentional modifications to a file.  A bad guy could create a file and then randomly flip bits to create two files (a good file and a malicious file) with the same MD5sum.  MD5sums are NOT a security check.

MD5sums are perfect for rooting out accidental corruption.  Downloaders being a horrible as they are.  (Who else has ever left IE downloading a large file and gone to bed only to find out they have a large corrupt hunk of junk in the morning?)  Windows still doesn't have a decent downloader for large files built in.  For this reason, the MD5sum is often included along with large file downloads to make sure you got all the data and it's the same as before it was sent.

These tools generate an md5sum for everything in a directory, with or without recursion.  The checker can verify md5sums you have generated, or you can compare the hash it spits out in a terminal window to the one which accompanied your download.

Since windows doesn't have a good way to generate or verify MD5sums, I created a few standalone windows programs to do just that.  You can find them in my tools section.  I hereby place my MD5sum tools in the public domain.  Please don't sue me if they eat your data, work badly or otherwise cause bodily injuries.

MD5sum directory

MD5sum recursive

MD5sum verify directory

MD5sum verify recursive

Promlem 6 - Sums of Squares

Problem 6

The sum of the squares of the first ten natural numbers is,

12 + 22 + ... + 102 = 385

The square of the sum of the first ten natural numbers is,

(1 + 2 + ... + 10)2 = 552 = 3025

Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025  385 = 2640.

Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.

Both the required subroutines are straight forward to implement.  The square of the sum grows much quicker than the sum of the squares.

Solution

#!/usr/bin/python

def sumsquare(val): #Returns the sum of the squares.
ss = 1
for each in range(2,val+1): ss = ss + each**2
return ss

def squaresum(val): #Returns the squares of the sums.
ss = 1
for each in range(2,val+1): ss = ss + each
return ss**2

if __name__ == '__main__' :
import sys
val = int(sys.argv[1]) # Bad Code, assumes input is an integer

print (sumsquare(val))
print (squaresum(val))
print (squaresum(val)-sumsquare(val))

The answer is 25502500-338350=25164150.  

Approach

I first define two functions which compute the desired sums.  The algorithms are clear and concise in python.  I did notice that the for loop, which presumably gets allocated all at once, uses an enormous amount of memory.  

Benchmarks

Python3 really did poorly here and Jython crashed.  Pypy was the most efficient as before.  Java crashed with an out of memory error so I decided to look at memory usage.  Python 3 was actually the most memory efficient followed by Pypy and Python 2.  Jython memory usage was reported despite the crash.  I have read that pypy is implemented on stackless python, and expected to see stack usage with the other versions.  However, none of the python versions used any stack memory.

CPU Usage

Problem #6 Benchmarks

time python factdiff.py 100000000

333333338333333350000000

25000000500000002500000000000000

25000000166666664166666650000000


real 0m37.971s

user 0m36.458s

sys 0m1.360s

time python -O factdiff.py 100000000

333333338333333350000000

25000000500000002500000000000000

25000000166666664166666650000000


real 0m38.709s

user 0m37.198s

sys 0m1.408s

time python3 factdiff.py 100000000

333333338333333350000000

25000000500000002500000000000000

25000000166666664166666650000000


real 1m16.192s

user 1m16.133s

sys 0m0.008s

time python3 -O factdiff.py 100000000

333333338333333350000000

25000000500000002500000000000000

25000000166666664166666650000000


real 1m16.864s

user 1m16.805s

sys 0m0.008s

time pypy factdiff.py 100000000

333333338333333350000000

25000000500000002500000000000000

25000000166666664166666650000000


real 0m10.756s

user 0m10.729s

sys 0m0.016s

time pypy -O factdiff.py 100000000

333333338333333350000000

25000000500000002500000000000000

25000000166666664166666650000000


real 0m10.672s

user 0m10.649s

sys 0m0.012s

time jython factdiff.py 100000000


java.lang.OutOfMemoryError: java.lang.OutOfMemoryError: Java heap space


real 0m38.766s

user 1m48.291s

sys 0m1.680s

Memory Usage

/usr/bin/time -f "%M" python factdiff.py 100000000

333333338333333350000000

25000000500000002500000000000000

25000000166666664166666650000000

"12750032"

/usr/bin/time -f "%M" python -O factdiff.py 100000000

333333338333333350000000

25000000500000002500000000000000

25000000166666664166666650000000

"12754544"

/usr/bin/time -f "%M" python3 factdiff.py 100000000

333333338333333350000000

25000000500000002500000000000000

25000000166666664166666650000000

"30688"

/usr/bin/time -f "%M" python3 -O factdiff.py 100000000

333333338333333350000000

25000000500000002500000000000000

25000000166666664166666650000000

"39264"

/usr/bin/time -f "%M" pypy factdiff.py 100000000

333333338333333350000000

25000000500000002500000000000000

25000000166666664166666650000000

"76832"

/usr/bin/time -f "%M" pypy -O factdiff.py 100000000

333333338333333350000000

25000000500000002500000000000000

25000000166666664166666650000000

"76864"

/usr/bin/time -f "%M" jython factdiff.py 100000000

Command exited with non-zero status 255

17467504

Conclusion

The way I implemented this problem led to large memory usage.  I have 16 GB of memory so I didn't run out, but I noticed a jump of several GB when I ran the benchmarks.  Python 2 used almost 13 GB as reported by the time function.  Python3 was the most memory efficient of the versions, but also the slowest to run.  

The answer was 25164150.

Problem 5 - Smallest Multiples

Problem 5

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

The most obvious number which would be divisible by 1-20 would be n-factorial (n!).  Obviously this would not be the smallest possible number or the question would be too simple.  What can be eliminated?  If you have 2 x 5 then the number will be divisible by 10 without having to multiply by 10.  This leads to the idea that only the prime factors are necessary.  But what about 12?  The prime factors are 2 and 3, but a number which includes 2 x 3 only will not necessarily be divisible by 12.  Thus you need all the repeated prime factors as well.  So we need to multiply all the prime factors of each number, including repeated factors for the composite to be divisible by each number.

Solution

#!/usr/bin/python

import sys
from primes import factor

def union(a,b):
for each in a:
if a.count(each)&gt;0 and b.count(each)&gt;0:
b.remove(each)
return a + b

if __name__ == '__main__':
#Determines the smallest number divisible by each of a range of numbers
#smaller than just n!
val = int(sys.argv[1])#Bad practice, assumes input is an int
factors = []
for each in range (2,val+1):
factors = union(factors,factor(each))
composite = 1
for each in factors:
composite = composite * each
print (composite)

Prime factors with repeats are [2, 3, 2, 5, 7, 2, 3, 11, 13, 2, 17, 19].

The answer is 232792560.  (n! is 2432902008176640000) 

Approach

I start by defining a "union" function.  In set theory, the union adds two sets together but doesn't repeat the common members of the set.  My approach was to compare the two sets and remove the repeats from one of the sets as I went along.  Then I can simply concatenate the remaining sets without overlap.

Benchmarks

The surprising result here was the poor performance of pypy.  In this case, pypy was slower than either Python 2 or 3.  I even repeated the tests to see if the computer happened to be busy when pypy was running.  With this program, pypy performed almost as slowly as Jython.

Problem #5 Benchmarks

time python primes20.py 2000


151117794877444315...


real 0m0.902s

user 0m0.896s

sys 0m0.004s

time python -O primes20.py 2000


151117794877444315...


real 0m0.945s

user 0m0.928s

sys 0m0.016s

time python3 primes20.py 2000


151117794877444315...


real 0m1.253s

user 0m1.252s

sys 0m0.000s

time python3 -O primes20.py 2000


151117794877444315...


real 0m1.276s

user 0m1.264s

sys 0m0.008s

time pypy primes20.py 2000


151117794877444315...


real 0m2.520s

user 0m2.508s

sys 0m0.004s

time pypy -O primes20.py 2000


151117794877444315...


real 0m2.511s

user 0m2.504s

sys 0m0.004s

time jython primes20.py 2000


151117794877444315...


real 0m3.102s

user 0m5.984s

sys 0m0.104s

Conclusion

This was an interesting twist on the prime factoring problem from earlier.  I had to modify the factoring code I had written not to throw away repeated prime factors.  Pypy had a surprisingly poor performance in this program and the "count" function used in my union subroutine may be implemented poorly in pypy.

Problem 4 - Palindromes

Problem 4

A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91  99.

Find the largest palindrome made from the product of two 3-digit numbers.

Solution

#!/usr/bin/env python

def ispal(num): #Check if the number is a palindrome
val = str(num) #Python just does the right thing here. Nice.
for each in range(0,int((len(val)+1)/2)): #Any mismatch return false
if val[len(val)-1-each]!=val[0+each]: return False
return True #otherwise return true

def calc(): #brute force looking for palindromes
temp = 0
largest = 0
for each in range(999,100,-1):
for other in range(999,100,-1):
temp = each * other
if ispal(temp):
largest = max(largest,temp)
return largest

if __name__ == '__main__' :
print (calc())

The answer is 906609.

Approach

This was one of the problems which took almost no time to code.  The seamless casting in Python made this one trivial.  You just work from both ends and look for mismatches.

Converting to a string worked exactly like it should have and python made it trivial to code.  Using some sort of built-in to reverse the string and see if it matches the original sting would probably be faster than a char by char comparison.

Benchmarks

The benchmarks fell out pretty much like the others.  Boring example, Sorry!

Problem #4 Benchmarks

time python palindromes.py

906609


real 0m0.746s

user 0m0.744s

sys 0m0.000s

time python -O palindromes.py

906609


real 0m0.764s

user 0m0.756s

sys 0m0.004s

time python3 palindromes.py

906609


real 0m0.839s

user 0m0.828s

sys 0m0.008s

time python3 -O palindromes.py

906609


real 0m0.875s

user 0m0.868s

sys 0m0.004s

time pypy palindromes.py

906609


real 0m0.090s

user 0m0.080s

sys 0m0.008s

time pypy -O palindromes.py

906609


real 0m0.087s

user 0m0.072s

sys 0m0.012s

time jython palindromes.py

906609


real 0m2.835s

user 0m5.852s

sys 0m0.176s

Conclusion

Python just worked here.  This problem took no time at all to code and worked on the first try.  The benchmarks agree with everything else we've seen.  The answer is 906609.

Problem 3 - Factoring Primes

Problem 3

The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?

This is the first problem I found with an interesting real world application.  Factoring primes is hard but multiplying out two primes is trivial.  That concept, called a one-way function, underpins modern cryptography.  The generation of large primes is a hard problem, but it is much harder to figure out which two primes were multiplied to make a given number than it is to generate those primes in the first place.  That's because modern computers are very, very good at multiplication and addition, but relatively slow at division.  Likewise, the brute force guessing of prime factors is very time consuming because there are a large number of primes.

All cryptography can be broken given enough time.  The trick is to make the math problem hard enough that the attacker gives up and does something else before he can decrypt your secrets.

Solution

Here's the code for Problem 3:

#!/usr/bin/python

def isprime(val): #Checks to see if a number is prime, brute force
for x in range(2, int(val**0.5)+1):
if val % x == 0: return False
return True

def factor(val): #Get the prime factors of a number
if isprime(val): return [val]
i = 2
thesefactors = []
tempval = val
while (i &lt;= tempval):
if tempval%i == 0:
thesefactors += [i]
tempval = tempval/i
i = 2
else:
i = i + 1
if len(thesefactors) &lt;= 1:
return [val]
else:
return thesefactors

if __name__ == '__main__':
import sys
factors = factor(int(sys.argv[1]))
print (factors)

This is run using the following command (with the correct number argument for the question asked):

python primes.py 600851475143

The correct answer is 6857.

Approach

Again, this is a brute force approach.  I have included a refinement called Newton's Improvement where you don't need to check if numbers larger than the square root of that number are factors.  This helps improve both subroutines.  These subroutines were both used in the solutions of later problems.

for x in range(2, int(val**0.5)+1):

Benchmarks

The question asked was too easy to make a good benchmark, so I created my own composite using the solution of a later problem involving counting primes.  The two primes I multiplied were 1299379 and 1299709.  The multiplication takes the blink of an eye, but the factoring takes many, many blinks.

As before, pypy is about 7-10x faster than Python2, with Jython being much slower and Python3 somewhere in the middle.

Problem #3 Benchmarks

time python primes.py 1688814580711

[1299379, 1299709]


real 0m0.329s

user 0m0.316s

sys 0m0.012s

time python -O primes.py 1688814580711

[1299379, 1299709]


real 0m0.380s

user 0m0.372s

sys 0m0.004s

time python3 primes.py 1688814580711

[1299379, 1299709]


real 0m0.715s

user 0m0.704s

sys 0m0.008s

time python3 -O primes.py 1688814580711

[1299379, 1299709]


real 0m0.772s

user 0m0.764s

sys 0m0.004s

time pypy primes.py 1688814580711

[1299379, 1299709]


real 0m0.083s

user 0m0.080s

sys 0m0.000s

time pypy -O primes.py 1688814580711

[1299379, 1299709]


real 0m0.083s

user 0m0.076s

sys 0m0.004s

Conclusion

The Problem 3 solution is a program with both real world uses and utility as a library for later problems.  The problem of locating and factoring primes is the holy grail of cryptography and this simple implementation gives some insight into prime numbers and the problem of factoring primes.

Problem 2 - Fibonachi Sequence

Problem 2

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

Solution

Here's the code for Problem 2:

#!/usr/bin/env python

def nextfib(a,b): #compute the next Fibonachi term
c = a + b
return (b,c) #keep the previous term

if __name__ == '__main__' :

import sys
a = 1
b = 2
mysum = 0
val = int(sys.argv[1]) #Bad code, assumes input is an int
while(b &lt; val):
if b%2==0: mysum += b #add it up if it's even
(a,b) = nextfib(a,b)
print(mysum) #print the answer at the end

You can run this code with the command:

python fibsum.py 4000000

The correct answer is:  4613732

Approach

The Fibonachi sequence is straight forward to compute.  You need to store the last two values in the sequence and add them up the get the next term.  If the value is even, you add it to the sum.

The only real programmatic difference between this and the previous problem was the use of a subroutine.  You can see the syntax for a subroutine here:

def nextfib(a,b): #compute the next Fibonachi term
c = a + b
return (b,c) #keep the previous term

Benchmarks

There was very little difference between the interpreters for this problem.  The Fibonachi sequence grows very quickly and it was difficult to get the compute time up enough for a benchmark.  As before, Jython was much slower and I believe we're seeing the virtual machine start-up time more than the actual compute time.  Java + Python takes longer to load than Python, which comes as no surprise.

Problem #2 Benchmarks

time python fibsum.py 400000000000000000000000000000000000000000000000000000000000000000000000000000

324236912809324524060519206539762341175704857242759930854194179672563128605028


real 0m0.025s

user 0m0.020s

sys 0m0.004s

time python -O fibsum.py 400000000000000000000000000000000000000000000000000000000000000000000000000000

324236912809324524060519206539762341175704857242759930854194179672563128605028


real 0m0.047s

user 0m0.040s

sys 0m0.004s

time python3 fibsum.py 400000000000000000000000000000000000000000000000000000000000000000000000000000

324236912809324524060519206539762341175704857242759930854194179672563128605028


real 0m0.032s

user 0m0.028s

sys 0m0.000s

time python3 -O fibsum.py 400000000000000000000000000000000000000000000000000000000000000000000000000000

324236912809324524060519206539762341175704857242759930854194179672563128605028


real 0m0.082s

user 0m0.076s

sys 0m0.004s

time pypy fibsum.py 400000000000000000000000000000000000000000000000000000000000000000000000000000

324236912809324524060519206539762341175704857242759930854194179672563128605028


real 0m0.035s

user 0m0.020s

sys 0m0.012s

time pypy -O fibsum.py 400000000000000000000000000000000000000000000000000000000000000000000000000000

324236912809324524060519206539762341175704857242759930854194179672563128605028


real 0m0.035s

user 0m0.016s

sys 0m0.016s

time jython fibsum.py 400000000000000000000000000000000000000000000000000000000000000000000000000000

324236912809324524060519206539762341175704857242759930854194179672563128605028


real 0m1.514s

user 0m3.204s

sys 0m0.164s

Conclusion

The relatively short compute time isolated the start-up time difference between Jython and the various Pythons.  At least Jython ran this time.    This was another easy problem and the code is simple.  The syntax for a subroutine was introduced for any beginners.

Problem 1 - Multiples of 3 and 5

Problem 1

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.

This is a real softball just to get people hooked.  The code could easily be a single line, but I have separated things out a bit.  I'll take the time to discuss the various boilerplate in my code in this blog post because the problem itself doesn't require much discussion.

I have also run my first benchmarks on several different interpreters.  I experiment with the -O switch which runs some sort of optimizations before running the script.  Interpreters tried include, Python 2 & 3, Pypy, and Jython.  The only modifications needed to run in Python 3 were the use of the new Python 3 "print ()" syntax which also worked in all Python 2 flavors.

There is an Ubuntu Launchpad project where I will host all my solution code.  You can get your very own copy on a linux box with bzr installed using this command:

bzr branch lp:eulerplay

Or you can browse online at:

http://bazaar.launchpad.net/~brywilharris/eulerplay/trunk/files

Solution

Here's the code for Problem 1: 

#!/usr/bin/env python

#This program adds all the integer numbers divisible by 3 and 5
#below a selected maximum number. &nbsp;It is a straight forward,
#brute-force approach.

if __name__ == '__main__' : &nbsp; #boilerplate

import sys &nbsp;#for command line input
sum = 0;
for i in range(0,int(sys.argv[1])): #int arg required
if (i%3==0) or (i%5==0): &nbsp;#divisible by 3 or 5?
sum = sum + i #add to the sum
print sum #spit it out at the end

This is run using the following command (with the correct number argument for the question asked): 

python add35.py 1000

Approach

This is a simple, brute-force solution.  I loop through the entire range and add up the numbers divisible by 3 and 5.  The modulo (%) operator lets me see which numbers are evenly divisible.

This program uses the simplest form of command line argument (using sys.argv), the boilerplate (__name__ == __main__ ) for use as a library on Windows and a simple for loop (for i in range(x,y)).  These are some of the only things a python programmer needs to learn to start writing code.  I'm  often pleasantly surprised when I don't know how to do something in Python and it just does what I mean on the first try.  Try that in Java some time.

The first line lets you invoke the script from the command line without specifying the interpreter. Instead of python add35.py 1000, you can just type ./add35.py 1000.  This line is not required when the interpreter is run manually, eg pypy add35.py 1000.

#!/usr/bin/env python

The sys library lets you access command line arguments in python. There are much fancier and more bullet proof ways of doing this, but none are quite this simple. 

import sys

This is how python handles for loops: 

for i in range(x,y):

Benchmarks

The following are some simple benchmarks using the unix "time" command.  Python can be run on a variety of interpreters without modification.   My 4-core Intel i7 processor positively spoils me for other machines  (Hopefully it's not bragging to say, "Your benchmarks may be slower").   Python 2.7.3 comes with my copy of Ubuntu 12.04.  I also tried Pypy version 2.7.2, Python 3.2.3 and Jython 2.5.1 running on Java 1.6.0_24. 

Code runs in a single thread for all benchmarks in this example.  The "real"number is the wall clock time the program took to set up and run.  This includes loading the interpreter into memory, any optimizations, and the reporting of results.  Later programs may be multi-threaded, but this one didn't need that.

This simple example can be timed with the following command: 

time python add35.py 1000

or

time python -O add35.py 1000

In this case, the -O (optimze) switch takes longer than running unoptimized:

bryan@myComputer:~/play$ time python add35.py 1000
233168

real 0m0.025s
user 0m0.024s
sys 0m0.000s
bryan@myComputer:~/play$ time python -O add35.py 1000
233168

real 0m0.071s
user 0m0.060s
sys 0m0.004s

Adding a few zeros makes the -O switch (just barely) worthwhile:

bryan@myComputer:~/play$ time python add35.py 100000000
2333333316666668

real 0m19.323s
user 0m18.457s
sys 0m0.772s
bryan@myComputer:~/play$ time python -O add35.py 100000000
2333333316666668

real 0m19.286s
user 0m18.417s
sys 0m0.792s

Python 3 took longer and required a modification to the print statement syntax.  print sum had to become print(sum).  It looks to me like Python 3 has a way to go before it starts getting optimized.

bryan@bryan-Aspire-V3-771:~/play$ time python3 -O add35.py 100000000
2333333316666668

real 0m22.498s
user 0m22.465s
sys 0m0.004s

On a lark I tried this in pypy.   Pypy is a python interpreter written in a version of python instead of c.  It seems like an interpreter written in an interpreted language would be the definition of clunky, but this isn't the case for pypy.  Pypy runs a lot faster in this simple case:

bryan@myComputer:~/play$ pypy -O add35.py 100000000
2333333316666668

real 0m2.833s
user 0m2.804s
sys 0m0.028s

Jython crashed with an out of memory error after 37 seconds for the number 100000000.  Jython fits my preconceived idea of an interpreter inside an interpreter much better than Pypy. I guess my jython benchmarks will be a bit limited.  Jython was able to solve the original problem, also shown below.

java.lang.OutOfMemoryError: java.lang.OutOfMemoryError: Java heap space

real 0m37.852s
user 1m48.999s
sys 0m1.732s

bryan@myComputer:~/play$ time jython add35.py 1000
233168

real 0m1.580s
user 0m3.444s
sys 0m0.136s

Conclusion

This is a straight-forward problem with a straight forward solution.  While a faster algorithm might be found (multiplying by threes and fives until you get to the target number might be faster) but it was not necessary.  The solution to the initial question above is 233168.  

Pypy is the fastest interpreter for this problem by a factor of almost 7x. Python 3 was slower than Python 2 and Jython was very slow even for this simple problem.  Jython ran out of memory and crashed when working with the bigger number used for the benchmarks.

Update:  

Multiplying out 3's and 5's is much, much faster.  Someone posted some code on the Problem 1 forum and I decided to try it out.  You first sum the multiples of 3 and then the multiples of 5.  To eliminate duplicates, you sum the multiples of 15 and subtract them out.  It's all multiplication and the run time drops significantly, 18x in fact.  Even Jython doesn't choke on this one.

bryan@bryan-Aspire-V3-771:~/play$ time pypy add35-alt.py 100000000
2333333316666668

real 0m0.153s
user 0m0.144s
sys 0m0.008s

bryan@bryan-Aspire-V3-771:~/play$ time jython add35-alt.py 100000000
2333333316666668

real 0m8.167s
user 0m10.605s
sys 0m0.476s