Friday, November 28, 2008

Super-Sharable, Self-Installing Widget

There are not many people that will appreciate this, but I just finished coding up a widget form that will install itself on other blogger blogs automatically. Then after it's been installed on someone else's blog it contains the same form so that their readers can add the widget. See it in action on my sidebar for the petit elefant. Here's the code:

<form id="supersharingwidget" action="http://www.blogger.com/add-widget" method="post"><!-- This is the beginning of the real widget content /--><a href="http://petitelefant.blogspot.com"><img border="0" src="http://img81.imageshack.us/img81/5783/elefantsc0.gif"/></a><br/>
<div>To add this button to your blog, copy and paste the text below into the HTML/JavaScript page element on your blog or simply press the button below.<br/><textarea onclick="this.select()">&lt;a href="http://petitelefant.blogspot.com"&gt;&lt;img border="0" src="http://img81.imageshack.us/img81/5783/elefantsc0.gif"/&gt;&lt;/a&gt;&lt;br/&gt;</textarea> </div><!-- This is the end of the real widget content /--><input value="http://petitelefant.blogspot.com/" name="infoUrl" type="hidden"/> <input name="widget.title" type="hidden"/> <!-- Do Not Change anything below this line /--><input id="pewc" name="widget.content" type="hidden"/> <input value="&lt;data:content/&gt;" name="widget.template" type="hidden"/> <input style="border: 0px none ; background: rgb(255, 255, 255) url(http://www.blogger.com/img/add/add2blogger_sm_b.gif) repeat scroll center center; width: 104px; height: 17px; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;" value=" " onclick="var wc = (document.getElementById('supersharingwidget').outerHTML)?document.getElementById('supersharingwidget').outerHTML + '<!--endssw/-->':document.getElementById('supersharingwidget').parentNode.innerHTML.match(/<form id=\u0022supersharingwidget\u0022(.|\n)+<\!--endssw\/-->/)[0].toString();document.getElementById('pewc').value = wc" type="submit"/> </form><!--endssw/-->

Tuesday, November 25, 2008

Count Controls in a Page in C#

Here is a simple method I created to count all the controls in a C#.NET page recursively.

int ControlCount( Control parentControl )
{
int current=0;
foreach( Control c in parentControl.Controls )
{
if (c.Controls.Count > 0)
{
current += ControlCount(c);
}
else
{
current++;
}
}
return current;
}

Thursday, November 13, 2008

WOL Wake On LAN

Have a Linksys Router you're trying to get working with WOL?
Wake On LAN
Wake On LAN (Local Area Network, this is your group of computers) is functionality that allows you to turn your computer on by sending a specially built message to it.

If you're a computer geek Wake On LAN is functionality supported either by your motherboard or your operating system and your NIC (Network Interface Card - this is what you use for your Internet Connection) that listens for special packets called Magic Packets that it then uses to power on or wake up from a non-interactive state.

Wake On LAN can wake up windows from sleep (s3) or hibernate (s4) but you're looking for motherboard support if you want to power on your computer from a shut down state (s5).
What are those s numbers?

Magic Packets
Magic Packets are specially formed UDP packets that signal a specific NIC to send a wake command to the computer. The structure of these packets is a 6 byte header (all ones - so FF FF FF FF FF FF in hex) and the MAC address of the computer to be woken up repeated 16 times for a total of 102 bytes.

MAC Address
A MAC address (Media Access Control address) is a special and mostly unique identifier for NIC Cards. Typically it is 6 Bytes long with the first 3 bytes being used to identify the make of the NIC Card and the last 3 bytes being used to identify your specific card. It's important to note that these MAC addresses or Physical addresses are not guaranteed to be unique, or in other words they can be reused.

Finding your MAC Address and Subnet Mask
The first thing you want to do if you're interested in WOL (Wake On LAN) is get some information about your computer. You can do this a couple of ways, through a command prompt, or through Windows Network Connections, and you may need help from another computer on the internet for your external IP address.

First go to Start>Control Panel>Network Connections. There should be a default one named Local Area Connection. Right-click this icon and choose Status. The choose the Support tab. Then click the Details button. Write down your Physical Address (This is your MAC Address) and Subnet Mask.

If you're doing it from a command prompt I'm going to assume you know what one is and how to launch it etc etc. The command you want to type in is ipconfig /all and you will see information about the various NICs installed in your computer. Look for Ethernet adapter Local Area Connection: as this is the default for a windows internet connection and find the Physical Address (something like 00-00-00-00-00-00), and the Subnet Mask (something like 255.255.255.0).

Finding your Internet-Exposed IP Address
The easiest way to do this is to go to http://www.benfinnigan.com/WOL/whatismyip.asp and write down the IP address it returns. There shouldn't be anything else on the page.

Monday, November 10, 2008

WOL - Wake On LAN through Linksys router

Want to learn more about WOL before starting?

How I got my Linksys WRT54G to Broadcast WOL Packets to my LAN
In my particular set up I have a cable modem, piping internet to a VOIP router piping internet to a wireless Linksys WRT54G router piping internet to my machine.



I wanted to be able to turn on my computer at home without having to call my dear wife and ask her to march downstairs and fire it up. Here are the steps that I performed to make it work:
  1. Prep the NIC Card: Start>Control Panel>Network Connections>Local Area Connection>Properties>Configure> Then looked around for Wake Up, Wake On LAN, settings under the advanced tab and made sure that everything was enabled for magic packets.

    Then I went into the power management tab and unchecked the "Allow the computer to turn off this device to save power" checkbox.


  2. Prep the Motherboard: While my computer is booting I see the Dell logo and some text about how to get into settings or BIOS (typically F2 or F10 or F something). Once I was inside the BIOS I looked around for settings in regard to Wake on LAN sometimes abbreviated WOL. I made sure that WOL was enabled.

  3. Prep the Routers: This is where it gets interesting. Linksys doesn't natively support forwarding ports to the broadcast IP of 255 (you get some JavaScript error "IP value is out of range [0 - 254]"), so to get around it you can try one of two methods (they both worked for me):
    1) I used firefox and DOM Inspector to change the value of the IP for port forwarding thereby circumventing the Javasacript validation. You have to have DOMI installed in Firefox, then inspect the page with the port forwarding for applications and gaming, then right-click the value in DOMI, choose edit, and set it to 255. After that is complete just save the settings.



    2) I also tried saving the html page and modifying the form manually. This also worked like a charm. You need to remember to change the action property of the form to prepend the url of the router. If your router was 192.168.1.1 then your form tag might be <form name="portRange" action="http://192.168.1.1/PortRange.tri" method="post"> assuming PortRange.tri was what you orginally found in the form. You also need to change the value of the IP you're forwarding to be 255. This is what my HTML looked like when I was done:
    <input class="num" onblur="check_valid_value(this,0,254,errmsg.err34,this.defaultValue,lanip,networkip,broadcastip)" maxlength="3" size="3" value="255" name="ip1">

    On the VOIP router I just forwarded the port I decided to use as the Linksys WRT54G which forwards to the broadcast on my LAN.

    Wait, what UDP port am I forwarding you ask? It doesn't really matter. Typically WOL is on 7 or 9 but as long as you pick a port that isn't being used by another application (in other words pick something really high) then you're probably just fine.
  4. Test the setup: So, to test the Wake on LAN settings I used this WOL monitor and wrote my own application for sending packets. Why would I write my own packet sender? Because I couldn't find one out there that didn't apply the subnet mask to the IP and broadcast the message. With my setup I wanted the packet to go directly to my VOIP router, so I built my own WOL application. It's pretty simple:

I also added functionality to send the packet every few seconds so that I could power down my machine while I had a remote machine sending packets to me every 60 seconds and see if my machine turned back on. If you don't want the click once installer you can download it from http://www.benfinnigan.com/WOL/WOL.zip Like usual, if you find the app useful, please drop me a line.

If you're having a hard time getting WOL to work for you, then try this forum to get your particular issue sorted out.

Update:05/27/2010
New! I have an Android App available for WoL and WoW. It's called WoL Wake on Lan Wan. Check it out here: http://blog.benfinnigan.com/2010/05/android-market-update-wol-wake-on-lan.html
Download it:




Disclaimer: The views expressed in this blog entry are provided "as-is" with no guarantee expressed or implied. If tweaking this stuff bricks your box or your router I'm not responsible. Any sites I've linked to are not to be construed as an endorsement and I cannot be held responsible for anything that goes on within other internet sites and their products or forums.

Tuesday, November 4, 2008

Where is settings.settings user.config?

Looking for the user.config file used to hold your user-scoped settings.settings? Try looking in %USERPROFILE%\Local Settings\Application Data\(AssemblyCompany from AssemblyInfo.cs if exists)\(exe name_Evidence Type_Evidence Hash)\(AssemblyVersion from AssemblyInfo.cs)\user.config

Thursday, October 2, 2008

VBScript Adding Large Hex Strings

This function is an example of how to add two large hex strings together keeping them as string values:
Function HexAdd(ByVal strNum1, ByVal strNum2)
size1 = Len(strNum1)
size2 = Len(strNum2)
If (size1 <> size2) Then
If (size1 > size2) Then
strNum2 = String(size1 - size2, "0") + strNum2
size2 = size1
Else
strNum1 = String(size2 - size1, "0") + strNum1
size1 = size2
End If
End If
' Begin adding
Dim i
Dim ret
Dim carry
Dim sum
ret = ""
i = CDbl(0)
carry = 0
For i = 1 To size1 '199999999999999999999998
a = "&H" & CStr(Mid(strNum1, size1 - i + 1, 1))
b = "&H" & CStr(Mid(strNum2, size1 - i + 1, 1))
sum = CInt(a) + CInt(b) + carry
ret = Hex(CStr(sum Mod 16)) & ret
carry = Fix(sum / 16)
Next
If (carry > 0) Then
ret = CStr(Hex(carry)) & ret
End If
HexAdd = ret
End Function

Call it like this:

ret = HexAdd("FFFFF", "123456789ABCDEF")

Wednesday, October 1, 2008

Handling Large Hex in VBScript

VBScript doesn't inherently support hex constants over 8 bits in length so I made a little function that attempts to handle large Hex strings and convert them to Decimals. It should be noted that Doubles lose precision in the E15 range of magnitude so beware using anything too large:
Function HexToDec(strHex)
Dim i
Dim size
Dim ret
size = Len(strHex) - 1
ret = CDbl(0)
For i = 0 To size
ret = ret + CDbl("&H" & Mid(strHex, size - i + 1, 1)) * (CDbl(16) ^ CDbl(i))
Next
HexToDec = ret
End Function
Function DecToHex(dblNumber)
Dim Q
Dim ret

ret = ""
Q = CDbl(Fix(dblNumber))
While Q > 0
ret = Hex(Q - Fix(Q / 16) * 16) & ret
Q = Fix(Q / CDbl(16))
Wend
DecToHex = ret
End Function

Called like this:

ret = HexToDec("0C0BA715B2223D47A8CAC87BE5D9679")
ret = DecToHex(CDBL(16843216856846468461654862))

Big Progressive is Watching

I’ve thought about this kind of device on more than one occasion, but it seems like it would raise privacy concerns. The device hooks into your OBD2 and transmits data to Progressive about how much you drive, how fast you turn, start, or stop, and what time of day you are driving.

They assure the consumer that unless legally obligated they will keep the information about your driving style to themselves, but I'm guessing it won't be long before the culpable driver in accidents will be determined with a device such as these. Beware consumer - Big Progressive is watching!


http://progressive.com/myrate/

Wednesday, September 24, 2008

Male Chauvinist Pigs Make More Money?

That's what this article says on the livescience website:

Men With Traditional Views on Sex Roles Earn More Money

Isn't that interesting? The comments at the bottom gave some interesting ideas as to why there may be a correlation.

I would question whether it's just a simple issue of age of theology, because older individuals tend to have more traditional beliefs and they tend to be further along in their career hence making more money. I wonder what the trend will look like in about 50-60 years.

Star Wars: The Force Unleashed - Manual poorly printed for Wii

For those of you reading this post in the hopes of finding a walkthrough please check this one out (starts on page 4):

IGN Guide

First let me say, I like to play Force Unleashed on the Wii. I think that despite it's shortcomings as a game the story is entertaining and I like the force powers enough to enjoy it and recommend it.

One thing that is driving me absolutely crazy is the lousy printing job done on the manual. I'll scan some pages in and add them to this post later.

UPDATE: Here they are:









Honestly though, it's all black and white. I can't see half the pictures as anything besides black squares and the descriptions on how to work things is so limited it's a real let down. I guess all the time they should have been pouring into the manual ended up as the tutorial section of the game and all the helpful tips.

Please next time let's use the color printer - Lucas Arts are you listening?

Sunday, August 24, 2008

Gosette.com selling minimonkey, silly billyz, B, slurp and burp



Well, my sister has found a product that both her and her baby enjoy called a mini monkey that she now imports and makes available at www.gosette.com. Anyway, I thought I would put up some pictures with a link to pictures from her album of minimonkey travels.





Thursday, July 17, 2008

Copy Generated Source Bookmarklet or Favelet

I wanted something simple to allow me to copy the generated source:

javascript:(function(){ var y = document.createElement('TEXTAREA');y.value = '<pre><html>\n' + document.documentElement.innerHTML + '\n</html>';y.createTextRange().execCommand("Copy");})();

Works in IE only.

Monday, July 14, 2008

Livecycle ES - ALC-DSC-110-000: com.adobe.idp.dsc.registry.endpoint.EndpointStoreException: endpoint registry failure.

Well, this error was the bane of my existence this evening. Anyway, when you get this error you'll find that workbench will not allow you to delete or remove the endpoints or category associated with the processes you were trying to remove. To clean out the rest of the data, you have to turn to the database and write some custom SQL to get the orphaned records out of tb_sc_endpoint where the name is the one you're trying to get rid of manually and tb_sc_service where id is the name of the one you're trying to delete.

To recap, if you get the ALC-DSC-110-000 error when trying to remove a process / orchestration and need to manually remove the remaining records delete from the tb_sc_endpoint and tb_sc_service tables where name or id is the process you were trying to delete when you got the error.

I hope that makes sense, feel free to post any questions you may have as comments.

Saturday, July 5, 2008

VW 1-liter Car - It's Coming by 2010!

The 1-liter car from VW is so named because it takes a mere .99 liters to propel the vehicle 100 km. That translates to about 235 MPG! Hypermilers move over, hybrids and fuel cells hide in shame, this car was originally prototyped in 2002! Now the car will be produced in small quantities by 2010, I've not found anything that says if it will be sold in the US, but if it is I'm getting one!

Back in 2002 I emailed Volkswagen and offered to drive a slightly-modified version coast to coast in the United States on a single tank of gas. It would only need 12 gallons of gas to get from New York City to Los Angeles! If I could get my hands on one I'd drive it with one of those mini-laptops and a pcmcia card for broadband access and set up a digital camera on the dash so that the world could see the entire drive from coast to coast (accellerated of course). I'd have to make sure that the camera also showed the fuel gauge and the odometer. I'd blog about the trip and post the videos. Long story short, they wrote me back and told me that they appreciated my interest in the car.

Now, the big news is the car is greenlit for production at the automaker's prototype shop, which can only produce 1,000 cars per year max. They're aiming for pricing 20,000 and 30,000 Euro ($41,200 to $61,800). They've made a few changes from the prototype; however, the stunning mileage numbers are not expected to change hugely.

Well if anyone from Volkswagen is reading this post, the offer still stands. Let me show that car off from New York City to Los Angeles!



If you're as passionate about the 1-liter car as I am you may want to check out:
The Original 1-liter Press Release
Ferdinand Piëch - The car exec that made it all possible
Ferdinand Piëch - 70th Birthday Press Release
The Wired Article About the Re-release
The Dallas Fox Article About the Re-release
The CarCentral Article About the Re-release
The Autoblog Post About the Re-release
A VW page about the 1-liter car

Friday, June 20, 2008

Will It Blend?

OK, so I found this website and I have to say I think it's pretty dang funny:

Willitblend.com

Basically, this happy looking guy takes everything under the sun and blends it with a blender. It's kind of like watching a trade show demonstration.

Thursday, June 19, 2008

Blogger Blogspot Pages scroll too much

OK, so, I just realized it's entirely possible some people have absolutely no idea why I went to the effort of making the posts script and the sidebar widget. It's simple really, when I read other peoples' blogs I find myself scrolling around like crazy. I hate scrolling, so I decided to come up with a solution to the problem rather than just complain about it.

Now, on this blog, you'll likely still do some scrolling (especially on long posts); however, you won't do as much with the navigation scripts place. It's kind of like tab-navigation for your blog.

http://blog.benfinnigan.com/2008/06/blog-post-navigation-script.html

http://blog.benfinnigan.com/2008/06/interesting-sidebar-widget.html

Blog Post Navigation Widget

I went ahead and tweaked out my sidebar navigation code to provide similar functionality for blog posts.

Here's the code:

<!-- BlogPostNav Widget By Benfinnigan.com /-->
<style type="text/css">
.postnavbutton {
cursor: pointer;
cursor: hand;
margin: 1px;
padding: 2px;
background-color: #ffffff;
color: #000000;
border-style: solid;
border-width: 1px 2px 2px 1px;
border-color: #C0C0C0 #000000 #000000 #C0C0C0;
}
.postnavbutton:hover
{
cursor: pointer;
cursor: hand;
margin: 1px;
padding: 2px;
background-color: #dddddd;
color: #000000;
border-style: solid;
border-width: 2px 1px 1px 2px;
border-color: #000000 #C0C0C0 #C0C0C0 #000000;
}
</style>
<script src="http://benfinnigan.com/js/blogpostnav.js" type="text/javascript"></script>
<!-- End BlogPostNav Widget By Benfinnigan.com /-->

Please give me a link back if you swipe the code and please let me know if you find errors.

Sidebar Navigation Widget



So, I just finished up a little sidebar navigation widget that helps de-clutter the ole blog.

Here's the code:

<!-- Sidebar Nav Widget By Benfinnigan.com /-->
<style type="text/css">
.sidebarnavbutton {
cursor: pointer;
cursor: hand;
margin: 1px;
padding: 2px;
background-color: #ffffff;
color: #000000;
border-style: solid;
border-width: 1px 2px 2px 1px;
border-color: #C0C0C0 #000000 #000000 #C0C0C0;
}
.sidebarnavbutton:hover
{
cursor: pointer;
cursor: hand;
margin: 1px;
padding: 2px;
background-color: #dddddd;
color: #000000;
border-style: solid;
border-width: 2px 1px 1px 2px;
border-color: #000000 #C0C0C0 #C0C0C0 #000000;
}
</style>
<script type="text/javascript">
//<!--
var sidebarid = 'sidebar';
var widgetClassPrefix = 'widget ';
var widgetClassDisqualifier = 'draggable-widget';
var blnsidebaraccordion = true;
// /-->
</script>
<script src="http://benfinnigan.com/js/sidebarnav.js" type="text/javascript"></script>
<!-- End Sidebar Nav Widget By Benfinnigan.com /-->

To add the sidebar navigation widget to your blog follow these steps:

video

If you play with it, please give me a link on your blog somewhere. If you find errors, please feel free to post a comment.

Wednesday, June 18, 2008

Pure ASP Hashing Function

Found this in some files I'd written a while back:


<% Option Explicit

' TITLE:
' Secure Hash Algorithm, SHA-1
'
' AUTHORS:
' Adapted by Ben Finnigan from VBA code by Iain Buchan
' http://wikisource.org/wiki/SHA-1_hash
' http://www.nwpho.man.ac.uk/Methods/Forms/DispForm.aspx?ID=6&Source=http:%2F%2Fwww.nwpho.man.ac.uk%2FMethods%2FForms%2FAllItems.aspx&RootFolder=%2FMethods
'
' PURPOSE:
' Creating a secure identifier from person-identifiable data
'
' The function SecureHash generates a 160-bit (20-hex-digit) message digest for a given message (String).
' It is computationally infeasable to recover the message from the digest.
' The digest is unique to the message within the realms of practical probability.
' The only way to find the source message for a digest is by hashing all possible messages and comparison of their digests.

' REFERENCES:
' For a fuller description see FIPS Publication 180-1:
' http://www.itl.nist.gov/fipspubs/fip180-1.htm

' SAMPLE:
' Message: "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
' Returns Digest: "84983E441C3BD26EBAAE4AA1F95129E5E54670F1"
' Message: "abc"
' Returns Digest: "A9993E364706816ABA3E25717850C26C9CD0D89D"

Function AndW(w1, w2)
Dim arr(3)
arr(0) = w1(0) And w2(0)
arr(1) = w1(1) And w2(1)
arr(2) = w1(2) And w2(2)
arr(3) = w1(3) And w2(3)
AndW = arr
End Function
Function OrW(w1, w2)
Dim arr(3)
arr(0) = w1(0) Or w2(0)
arr(1) = w1(1) Or w2(1)
arr(2) = w1(2) Or w2(2)
arr(3) = w1(3) Or w2(3)
OrW = arr
End Function
Function XorW(w1, w2)
Dim arr(3)
arr(0) = w1(0) Xor w2(0)
arr(1) = w1(1) Xor w2(1)
arr(2) = w1(2) Xor w2(2)
arr(3) = w1(3) Xor w2(3)
XorW = arr
End Function
Function NotW(w)
Dim arr(3)
arr(0) = Not w(0)
arr(1) = Not w(1)
arr(2) = Not w(2)
arr(3) = Not w(3)
NotW = arr
End Function
Function AddW(w1, w2)
Dim I, arr(3)

I = CLng(w1(3)) + w2(3)
arr(3) = I Mod 256
I = CLng(w1(2)) + w2(2) + (I \ 256)
arr(2) = I Mod 256
I = CLng(w1(1)) + w2(1) + (I \ 256)
arr(1) = I Mod 256
I = CLng(w1(0)) + w2(0) + (I \ 256)
arr(0) = I Mod 256

AddW = arr
End Function
Function CircShiftLeftW(w, n)
Dim d1, d2

d1 = WordToDouble(w)
d2 = d1
d1 = d1 * (2 ^ n)
d2 = d2 / (2 ^ (32 - n))
CircShiftLeftW = OrW(DoubleToWord(d1), DoubleToWord(d2))
End Function
Function WordToHex(w)
WordToHex = Right("0" & Hex(w(0)), 2) & Right("0" & Hex(w(1)), 2) & Right("0" & Hex(w(2)), 2) & Right("0" & Hex(w(3)), 2)
End Function
Function HexToWord(H)
HexToWord = DoubleToWord(CDbl("&H" & H))
End Function
Function DoubleToWord(n)
Dim arr(3)
arr(0) = Int(DMod(n, 2 ^ 32) / (2 ^ 24))
arr(1) = Int(DMod(n, 2 ^ 24) / (2 ^ 16))
arr(2) = Int(DMod(n, 2 ^ 16) / (2 ^ 8))
arr(3) = Int(DMod(n, 2 ^ 8))
DoubleToWord = arr
End Function
Function WordToDouble(w)
WordToDouble = (w(0) * (2 ^ 24)) + (w(1) * (2 ^ 16)) + (w(2) * (2 ^ 8)) + w(3)
End Function
Function DMod(value, divisor)
DMod = value - (Int(value / divisor) * divisor)
If DMod < 0 Then DMod = DMod + divisor
End Function
Function F(t, B, C, D)
Dim casenum
If t <= 19 Then casenum = 1
If t <= 39 And t > 19 Then casenum = 2
If t <= 59 And t > 39 Then casenum = 3
If t > 59 Then casenum = 4
Select Case casenum
Case 1
F = OrW(AndW(B, C), AndW(NotW(B), D))
Case 2
F = XorW(XorW(B, C), D)
Case 3
F = OrW(OrW(AndW(B, C), AndW(B, D)), AndW(C, D))
Case 4
F = XorW(XorW(B, C), D)
End Select
End Function
Function sha1(inMessage)

Dim inLenW
Dim w(79)
Dim temp
Dim A, B, C, D, E
Dim H0, H1, H2, H3, H4
Dim K(3)
Dim arr(3)
Dim inLen, padMessage, numBlocks, blockText, wordText, I, t

inLen = Len(inMessage)
inLenW = DoubleToWord(CDbl(inLen) * 8)

padMessage = inMessage & Chr(128) & String((128 - (inLen Mod 64) - 9) Mod 64, Chr(0)) & String(4, Chr(0)) & Chr(inLenW(0)) & Chr(inLenW(1)) & Chr(inLenW(2)) & Chr(inLenW(3))

numBlocks = Len(padMessage) / 64

' initialize constants
K(0) = HexToWord("5A827999")
K(1) = HexToWord("6ED9EBA1")
K(2) = HexToWord("8F1BBCDC")
K(3) = HexToWord("CA62C1D6")

'initialize 160-bit (5 words) buffer
H0 = HexToWord("67452301")
H1 = HexToWord("EFCDAB89")
H2 = HexToWord("98BADCFE")
H3 = HexToWord("10325476")
H4 = HexToWord("C3D2E1F0")

'each 512 byte message block consists of 16 words (W) but W is expanded to 80 words
For I = 0 To numBlocks - 1
blockText = Mid(padMessage, (I * 64) + 1, 64)
'initialize a message block
For t = 0 To 15
wordText = Mid(blockText, (t * 4) + 1, 4)
arr(0) = Asc(Mid(wordText, 1, 1))
arr(1) = Asc(Mid(wordText, 2, 1))
arr(2) = Asc(Mid(wordText, 3, 1))
arr(3) = Asc(Mid(wordText, 4, 1))
w(t) = arr
Next
'create extra words from the message block
For t = 16 To 79
'W(t) = S^1 (W(t-3) XOR W(t-8) XOR W(t-14) XOR W(t-16))
w(t) = CircShiftLeftW(XorW(XorW(XorW(w(t - 3), w(t - 8)), w(t - 14)), w(t - 16)), 1)
Next

'make initial assignments to the buffer
A = H0
B = H1
C = H2
D = H3
E = H4

'process the block
For t = 0 To 79
temp = AddW(AddW(AddW(AddW(CircShiftLeftW(A, 5), F(t, B, C, D)), E), w(t)), K(t \ 20))
E = D
D = C
C = CircShiftLeftW(B, 30)
B = A
A = temp
Next

H0 = AddW(H0, A)
H1 = AddW(H1, B)
H2 = AddW(H2, C)
H3 = AddW(H3, D)
H4 = AddW(H4, E)
Next

sha1 = WordToHex(H0) & WordToHex(H1) & WordToHex(H2) & WordToHex(H3) & WordToHex(H4)
End Function
%>

If you find it useful, please post a comment letting me know.

Firefox 3.0 DOMI (Dom Inspector) is missing!

So, I went and downloaded Firefox 3.0 on download day. Awesome, much faster JS support. Question I have is where did DOM Inspector go?! Anyway, I found it:

https://addons.mozilla.org/en-US/firefox/search?q=Dom+Inspector&cat=all

The weird thing is that if you don't click the add to firefox button directly from that page you actually get an Add-On not found page that forwards you back to the search page... LAME. Anyway, the one by Shawn Wilsher (sdwilsh) is the right one, Enjoy!

Ceiling Fan Bulb Bases

OK, so I went to the store to buy a light for a fan I have up in my house and lo and behold I'll be darned if Home Depot or Lowes has a light with medium (non-candelabra) bases. I have no idea why these are moving in that direction as I would think a single standard base would be more desirable. Who knows, maybe knuckleheads are burning down their homes putting bulbs in that are over the 60W limit.

Tuesday, June 17, 2008

Firefox Download Day Blues

Today Tuesday 6/17/2008 at 1PM EST Download Day for Mozilla Firefox 3.0 officially started. Since then the spreadfirefox.com site ( http://www.spreadfirefox.com/worldrecord/ ) has been experiencing many of the symptoms of a DDOS (Distributed Denial of Service). What I'm seeing in Firefox 2.0 is "The server at www.spreadfirefox.com is taking too long to respond."

So, in the meantime, if you want Firefox 3.0 and want to be able to download it now, then try browsing to their other download site:

http://www.mozilla.com/products/download.html?product=firefox-3.0&os=win&lang=en-US

Friday, June 13, 2008

Mario Kart is Awesome!

So, we bought a Wii with our stimulus package and I love it! I got out of console gaming because there were getting to be too many buttons on the controllers and I couldn't just sit and play a game. Now, with the Wii I find games intuitive and easy to play again.

Mario Kart is an excellent example of intuitive gameplay... You have a wheel, use it to steer.

Thursday, June 12, 2008

Blogger as my web page

I've had benfinnigan.com for a while now and it's been useful a couple of times, but now it's time to hand over the maintenance to blogger/blogspot. I found I mostly just wanted a blog anyway and kept the web space around for tinkering- I guess now I'll have to tinker on my localhost.