# Recent blog entries for DeepNorth

Yeah, you would think I would have something better to put here after such a long absence. Still, it's something.

This is nearly identical to the code for the Credit Card Checksum posted earlier. This code does the validation of the checksum for an Ontario health card. I needed it for a project with the Ministry, found my own code on the Internet (!) and hacked it to fit.

I don't know the exact quote, but someone well known in open source said something to the effect that real men don't do backups, they just publish to the Internet. Here's my backup. Cheers,

Bob

```
'Health Card Validation Routine (Visual Basic)
'
'Copyright (c) Bob Trower, 2001, 2010
'This source code may be used as you wish, provided
'that these comments remain in the code.
'
'Returns True if the card number is valid, False otherwise
'Algorithm is the one specified by the Ontario Ministry
'of Health (in turn similar to the 'LUHN' formula
'specified in ANSI X4.13)
'Last Digit of Card Number is the 'check digit'.
'From right to left, take value of check digit and add:
'   double every second number and sum resulting digits.
'   add the non-doubled digits.
'If the Health Card Number is valid, the final sum
'will be an even multiple of ten ((x mod 10) = 0 ).
Function IsValidHCNumber(HCNumber As String) As Integer
Dim CheckSum As Integer
Dim ThisDigit As Integer
Dim i As Integer
' Note: Order of Steps is important...
IsValidHCNumber = False ' Redundant in VB, but good
practice
If Len(HCNumber) = 10 Then ' Known Card numbers are 10
digits long
CheckSum = Val(Mid(HCNumber, Len(HCNumber), 1)) 'Last
Digit is CheckSum Digit
For i = Len(HCNumber) - 1 To 1 Step -2
ThisDigit = Val(Mid(HCNumber, i, 1)) * 2 ' Double
these digits
CheckSum = CheckSum + (ThisDigit \ 10) +
(ThisDigit Mod 10) ' Add the sum of the resulting digits
Next
For i = Len(HCNumber) - 2 To 1 Step -2
CheckSum = CheckSum + Val(Mid(HCNumber, i, 1)) '
Add these digits
Next
If CheckSum Mod 10 = 0 Then ' Resulting number should
be an even multiple of 10
IsValidHCNumber = True
End If
End If
End Function

```

The base64 source code that I released in 2001 (http://base64.sourceforge.net/b64.c) has found very wide application and is used in remarkably diverse software. Below are some examples.

In the preamble to the code, I say that 'Generally' "This program is designed to survive:" I would say that it has done admirably in that regard. However, it is not form, nor even function that I think is responsible for its travel. It is a combination of there being few reasonable alternatives, this *being* a reasonable alternative AND the function itself is ubiquitous. Nearly every kind of non-trivial software eventually deals with mail (there is an old programmer's joke about this) and mail means attachments and attachments mean MIME and MIME means base64 encoding. Chances are; this is not even that well traveled as such. It may just be the 'luck of the draw' that there are so many requirements for this that mine was adopted by chance. I like to think the fact that there were (and are), no known bugs after seven years of use has something to do with it. I also fancy it was well written. I like to think it pleased other programmers, as it was intended to do. YMMV. Note that at least *some* of these programmers had a clue.

Editing application The World Wide Web consortium's HTML editor. This is the body responsible for setting the standards for web pages on the Internet http://dev.w3.org/cvsweb/Amaya/thotlib/dialogue/base64.cpp?rev=1.4&content-type=text/x-cvsweb-markup

Secure Operating System Stanford University -- Histar Secure Operating System. http://www.scs.stanford.edu/histar/jos64/lib/base64.c

Gammu utility and library for mobile phones http://cihar.com/gammu/docs/coding_8c.html

WebClaire Claire language kernel. http://www.claire-language.com/cgi-bin/trac.cgi/browser/trunk/xl/kernel/clSystem.cpp?rev=1667

Asterisk Voice over IP Appliance (http://www.digium.com) http://svn.digium.com/view/asterisk/team/group/xcon_bfcp/apps/xcon_bfcp/bfcp_base64.c?view=markup

ziproxy -- HTTP proxy server http://ziproxy.sourceforge.net/

Epona Internet Relay Chat (IRC) libraries http://bugs.epona.org/cgi-bin/trac.cgi/browser/libraries/misc/base64.cc

Word Document to PDF file converter http://doc2pdf.sourceforge.net/

Colorado State University Network Security -- Reflected DNS daemon https://www.netsec.colostate.edu/dnsmonitor/files/README

OpenQM post-relational database http://www.openqm.org/downloads/readme.txt

HDTV Set Top Box (Digital Television) http://www.pacemicro.com/media/americas/PDF/manuals/tdc575d_manual.pdf

WinRSA -- Public key encryption for Windows http://users.cs.cf.ac.uk/Antonia.J.Jones/Freeware/Encryption/licence.txt

Partman-Crypto (use in Debian Installer -- http://en.wikipedia.org/wiki/Debian-Installer) Note that the b64.c code is used in a number of places in most major Linux Distributions. http://packages.debian.org/changelogs/pool/main/p/partman-crypto/partman-crypto_24/copyright

SMTP Stress Testing Tool http://xstress.sourceforge.net/

Philips Flat Panel Television Sets (i.e. http://www.p4c.philips.com/files/4/47pfl5432d_37/47pfl5432d_37_pss_aen.pdf) http://www.p4c.philips.com/files/4/47pfl5432d_37/47pfl5432d_37_osr_aen.txt

Technical University of Denmark, Key Management in Cryptographic Access Control (Thesis) http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/4447/pdf/imm4447.pdf

eMail -- Command line SMTP email utility. http://svn.cleancode.org/svn/email/src/mimeutils.c

Recommended by IBM for use with IBM Communications Server http://www.redbooks.ibm.com/redbooks/pdfs/sg247340.pdf

Spam Decoding Tools http://www.futuresoft.dk/mirrors/spamlinks.net/tools-deobfuscate.htm

Research Software http://portal.acm.org/citation.cfm?id=1151835&jmp=cit&coll=ACM&dl=ACM&CFID=15151515&CFTOKEN=6184618

Voice over IP telephony (software telephone) openwengo http://dev.openwengo.com/trac/openwengo/trac.cgi/browser/wifo/trunk/eXosip/src/base64.c

What gives with the Wikipedia mob? I know that they have gotten an (undeserved, I hope) bad rap for altering pages with wild abandon. However, I really did not expect to see what just happened.

I had a client to whom I was sending a copy of my company's development methodology. Unfortunately, with more than a million files on the companies network here, I can't find the doc in question. However, I did find the nice image that accompanied the document.

I thought that I would do a 'reality check' against articles on software development at Wikipedia and I did not find quite what I was expecting. If our (relatively simple) take on what is actually done on software projects is not represented there, it makes me wonder.

FWIW, the diagram merely shows the flowchart (arrows, docs, decision diamonds, 'things', etc) of the following development cycle:

1. INSPIRE
• Identify needs/opportunities
• Create requirements
2. DESIGN
• System design
• String (sub-system) design.
3. CODE
• Unit Design, build and test
• String (multiple units) Design, build and test.
4. BUILD
• String Assembly
• Full System Build
5. TEST
• System Test (all works together)
• User acceptance Test (System is acceptable to client)
6. RELEASE
• Release to Pilot
• Release to production.

What is nice about the diagram is that it shows in a tidy way how these stages flow into one another both forward and back and shows the entire life-cycle from conception to system retirement. It also shows how (and why) it's possible (as happens) that a system could make it all the way to release into production and then almost immediately retired.

I wonder: how many other people like myself have been discouraged by such actions at Wikipedia? My time is limited and that article may now not see the light of day. That's a shame.

I would link to the offending pages, but unfortunately that appears to be considered bad practice at Wikipedia and might even get me banned (oh my)!

I see that Advogato is in danger of going away.

Note that I would have posted a reply, but someone has changed the level of my certification to 'observer' and I can't post. I am not sure what they have in mind in terms of gauging how many people are interested if they have taken away the ability to indicate opinions. I am sure they have their reasons, but I confess to some annoyance about this.

FWIW -- I would prefer that Advogato stay and I do not see Blogs as an alternative for the way I use this resource.

It would be a shame if Advogato went away. I do not look here as frequently as I used to, but I do still check from time to time. It is one of the few places where you can find something worth reading without wading through all kinds of nonsense.

I also find this a very mannerly community. I like that.

It is rather a shameful secret, but I really liked this forum to publish an article when the need struck me. I knew that the article would get some eyeballs and those eyeballs would be ones I expected would understand what I had to say. I took a little care before posting, but did not torture myself with the level of care I would before a normal publication. That was good (sometimes).

Best wishes to everyone in this community. If anyone needs to find me, they can just 'Google' my name or even my handle and they will likely find me soon enough.

Ironically, I was just getting prepared to publish some things and would likely have announced them here. I am at a loss as to what would be a similar venue. I did not check them all out, but places like Blog Farms, etc. are not nearly the same (for me) as this is. I have plenty of my own sites and servers if I just want to blather...

Again, my best wishes to everyone.

13 Mar 2005 (updated 13 Mar 2005 at 05:17 UTC) »

Jiminy Crickets! I see it has been a while.

I posted a bunch of code for an md5 hashing utility on the front page. Hope that does not lead to a host of flames...

I think the thing is newsworthy, because a whole bunch of people either are or should be swapping out any SHA1 code they are using, pronto. I had to. Problem was, there was simply no code that I could work with out there.

I rant on this all the time, but I simply must harp on it again: some of that stuff does not work. People do something rather difficult, like the md5 hashing code and then just seem to run out of gas. They do not test/package/test and they seem unable to comprehend that other people's development environments may be different.

Now, on the topic of 'different environments', I am sure I will be flamed because I took all the 'endian' junk out of the md5 code. Sue me. 99.999% of all the machines that are likely to use my md5 utility/library code don't need that junk cluttering the code. It's easy to find elsewhere and slap back in if you need it. Meantime, with all the crap stripped out, this code stands a good chance of compiling without any tweaks on just about any box out there.

Anyway, as aggravating as this exercise was, it is nice to have something reasonably publishable from all the mountains of code I have written.

Oh -- BTW -- I am out of town for a while and may not even look at the web. Don't go nuts if you don't see a response from me.

Cleaning up a whole bunch of stuff on my network and in archival storage. I am having major troubles converting all of my data, sources, documents, etc. to modern formats. Some of this stuff goes back to 1984 and earlier. Naturally, I am ditching tons of stuff. I am pretty much tossing all of my some thousand or so diskettes. Some of the disks have become unreadable after a decade or more of aging. Stuff that was once dreadfully important, like sources for various commercial products are being tossed because it's not worth the effort to sort through it all. Same goes for the million or so files on hard disks.

If I come across stuff like the below that can just be cut and pasted onto the net, I'll try to do so.

Here is a piece of code that might be useful to someone googling for credit card validation. Enjoy.

```'Credit Card Validation Routine (Visual Basic)
'
'Copyright (c) Bob Trower, 2001
'This source code may be used as you wish, provided
'that these comments remain in the code.
'
'Returns True if the card number is valid, False otherwise
'Algorithm is the 'LUHN' formula specified in ANSI X4.13
'Last Digit of Card Number is the 'check digit'.
'From right to left, take value of check digit and add:
'   double every second number and sum resulting digits.
'   add the non-doubled digits.
'If the Credit Card Number is valid, the final sum
'will be an even multiple of ten ((x mod 10) = 0 ).
Function IsValidCCNumber(CCNumber As String) As Integer
Dim CheckSum As Integer
Dim ThisDigit As Integer
Dim i As Integer
' Note: Order of Steps is important...
IsValidCCNumber = False ' Redundant in VB, but good practice
If Len(CCNumber) > 10 Then ' Known Card numbers are more than 10 digits long
CheckSum = Val(Mid(CCNumber, Len(CCNumber), 1)) 'Last Digit is CheckSum Digit
For i = Len(CCNumber) - 1 To 1 Step -2
ThisDigit = Val(Mid(CCNumber, i, 1)) * 2 ' Double these digits
CheckSum = CheckSum + (ThisDigit \ 10) + (ThisDigit Mod 10) ' Add the sum of the resulting digits
Next
For i = Len(CCNumber) - 2 To 1 Step -2
CheckSum = CheckSum + Val(Mid(CCNumber, i, 1)) ' Add these digits
Next
If CheckSum Mod 10 = 0 Then ' Resulting number should be an even multiple of 10
IsValidCCNumber = True
End If
End If
End Function
```
23 Aug 2004 (updated 9 Oct 2004 at 17:54 UTC) »

This post is really about personal stuff. Read if you dare, but it's pretty boring unless you know me personally or are mutually affected by various problems I've had of late.

A lot of my/our troubles would have had much less impact had the tech economy not imploded. It must come back and continue to grow, but the timing of it and the nature of the comeback may not help North Americans that much. A lot of my business has been with Telecomms and related enterprises and we know how that has been.

We are many orders of magnitude of bandwidth below where we all need to be, so this has to make a strong comeback at some point. However, recovery has been spotty so far.

Some friends have had various troubles of late including near death experiences and moving half way across the world. Family have also been having health problems. My goodness. If anyone of you are reading this, my best wishes to you.

Many things have been just a drag on me and my little company this past year or so. I was really hoping to get some time to publish some of my stuff on Sourceforge, but have just been interrupted by one thing or another. Just got back from a trip to Europe for 30 days. It was ok, but really for the wife and kids. I would have liked to take the time to just put my head down and write code, but family comes first these days (as it should).

Like if anybody cares, friends are starting a commercial music site http://www.tzome.com
I am wishing them luck and they have a great idea. Despite note about commercial stuff below, I hold out hope that someone ethical can actually make money in cyberspace. We shall see.

Note that nobody asked about the radix sort, so I have still not prepped this for publication. I am so short on 'hobby time'... This is unfortunate, since that seems to be the stuff that lasts and speaks the best about a person. (Sighs). All of this website activity over the years has been a sink for time/money. I believe in it, but it still seems that only the unscrupulous (sp?) make a financial go of things in cyberspace.

Have struggled with downed sites due to a failed failover (long story) and an unscrupulous primary hosting operation. Oh my.

Sites affected:

arpaul.com
brockvegas.com
brockvilleclub.com
canpsych.com
cleandata.biz
cleandata.us
courtofarbitration.com
datachat.com
datahush.com
dereng.com
dreamweave.com
easydad.com
hushdata.com
hushfinance.com
hushnet.com
hushserver.com
hushvote.com
hushwebs.com
infinikey.com
petertrower.com
purehell.org
purewish.com
randa.hushfinance.com
realphd.com
trantor.biz
trantor.us
truebob.com
truedad.com
truepoem.com
verytrue.com
whiteboxvoting.com
wobbe.biz
yddm.com

Had Advogato not gone down for a while itself, I would have beaten myself up over this, even though all reasonable precautions were taken.

Unlike Advogato, there are a lot of sites affected here and they had more than one backup strategy since they vary in age. It has been a real challenge to restore all of these sites.

Clients sites whose backups we maintain went up quickly once we switched servers. However, a couple of clients maintained their own backups and one is still recovering (very long story here).

We, of course, are the shoemaker's children. Our own sites are the last to be dealt with and we are still in the midst of restoring these. Things could be worse, but disaster-recovery-wise, this was a worst-case scenario.

Looking on the bright side, though, my strategy of paranoid multiple systems and backups paid off. We at least have been able to recover.

Have posted some additional material about Migrating From Microsoft"

It is astonishingly cold here today -- approaching the point where Celsius == Farenheit. No bother for me. I am wearing "performance underwear".

Am about to start some prototype coding for a 'vector translation' engine pursuant to research into 'advanced data packaging' -- whatever that means.

Mulling over the idea of preparing a GPL'ed version of a 'raw radix' sort in ANSI C. For short records of -non-degenerate' data it is the fasted sort I have tested -- much faster than quicksort on large files. Would anybody care?

19 Aug 2003 (updated 19 Aug 2003 at 17:16 UTC) »

Have posted another article. Things really do move slowly here. If I wanted to and had the time, I could post the majority of articles on this site.

I note that diary entries take place fairly frequently, but I wonder who reads them. I have scanned a few and it seems a totally mixed bag -- not worth wading through. Some of the stuff could/should have been posted as articles and some of the stuff could/should have been better left unsaid. Maybe this entry is one of the latter :)

I'm wondering now if things are not slower here than they have been in the past.

Even though I've never joined before, I've been here before and it seems to me it was more active. What has happened, I wonder? I never went in for the mayhem that is slashdot, but they are active -- I'll give them that.

I like the minimalism of the site, but I wonder if that has anything to do with the apparent lack of interest. My sites are similarly (well, not quite) minimalist and we have been criticised for not being 'jazzy enough'. I would have thought a lot of serious hackers would go for this sort of lean content driven stuff. However, there seems to be a lack of interest, going by the number of articles and replies.

OTH -- maybe less is more with respect to the traffic here. I noticed that the replies to one of my articles here were quite thoughtful. Maybe a lower amount of high quality traffic is best. I will ponder this.

3 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!