Jopsen.dk - A Personal website

January 14, 2008
HSH – A simple hash algorithm + embedded webserver
Filed under: Computer,Electronics,English,School by Jonas Finnemann Jensen at 20:01

Lately I’ve been building a webserver, in school as a light and curtain controller, on top of an AtMEGA168 and ENC28J60, I’ve based it off an article I found at TuxGraphics.org. Which by the way is a fine place to order components for personal usage – They’re cheap and they shipped to Denmark in 2-3 days…

Anyway, the webserver software I found sends a plaintext password over HTTP for authentication. This is of course not desirable since anybody with access to the same network link can see the password. This is very bad security, especially if it’s a wireless link. And who would want a light and curtain controller if the neighbor kid suddenly hacked it.

Therefore I decided that I needed a secure authentication method. Asymmetric cryptographic algorithms are already out of the question since I’m working on a microprocessor with 16kbytes program memory. I tried to find a conventional md5 or sha1 implementation, however they were very easily too big in program size and inefficient. So I looked around and found HSH 11/13 by Herbert Glarner.

HSH 11/13 looked to be efficient, small and easy implement. Later I discovered that with my lack of experience with bit manipulation in C ladder was not true. However, I did manage to get an implementation working, it’s written in C and I’ve tested it with GCC and AVR-GCC against glibc and AVR-libc respectively. You may download it here:

Now having a webserver with a serverside hash algorithm doesn’t solve the issue. The client needs to have the hash algorithm as well. Therefore I wrote a compatible implementation of HSH 11/13 in Javascript. This may seam rather weird, and it’s sure not efficient anymore. I’ve only tested the script in Firefox 2.0, however I’d imagine that it works in other browsers as well. You may download the Javascript implementation here:

Like I said before this may seam rather weird, as the webserver isn’t capable of serving pages as big as the Javascript implementation. However the solution is to let the main page of the embedded webserver be:

< script src = 'http://mywebhost.com/myjsfile.js' > < / script>

Where “http://mywebhost.com/myjsfile.js” is a file located on a remote ordinary webserver, e.g. not served from the embedded webserver. The included Javascript file then writes an entire web 2.0 application using “document.write”. Once the web 2.0 application have been loaded it can use AJAX requests and the HSH 11/13 implementation to communicate with the embedded webserver.Apart from the main page, a simple AJAX API is all the embedded webserver needs to host. Authentication against the webserver may then be done using a HSH hashsum of a timestamp + password + data, referred to as token. Where timestamp, data and token, are send everytime an API request is made. The embedded webserver then knows the password and generates the token from the given timestamp and data, one can then authenticate the request by comparing the generate token with the received token. Note, it may not be desirable to keep track of time on a embedded webserver, so it’s easier to just check if received timestamp is bigger than the latest received timestamp, and then save the timestamp for later use.

3 Comments »

  1. Hey Jonas, Excellent article and job! I will try to use it in my webserver! really helpful! :)

    Comment by Jonathan — August 23, 2008 @ 10:06

  2. Update: I’ve fixed a bug in HSH.c which generated errors if strings were longer than 4 characters.
    (Download links have been updated).

    Comment by Jonas Finnemann Jensen — August 23, 2008 @ 12:46

  3. thats a great idea. i did a similar project and had to crack my head to find out a solution to the authentication issue. i used a the TEA Algorithm (Symmetrical Encryption)and a JAVA applet on the client side.

    Comment by rohit — October 23, 2008 @ 15:50

Leave a comment



finpecia tabletten buy Zithromax with a visa free fedex delivery prednisone Accutane without dr order accutane online buy Accutane line Crestor10mg Valtrex effects purchase online prescription Flomax order xenical online with overnight delivery order valtrex online no prescription buy genuine Prednisone online Zithromax Valtrex no prior script purchase cheap Valtrex Valtrex cheap where to purchase Buspar no prescription no fees purchase Orlistat overnight order Prednisone without a rx overnight shipping buy cheap Prednisone no prescription Xenical canadian pharmacy Flomax precio buy Tamsulosin pills in toronto purchase prednisone without a prescription online Flomax toronto cheap Xenical no rx Buy prednisone without a perscription to ship overnight buy Rosuvastatin uk buy Valtrex fed ex purchase Orlistat online without rx buy Orlistat diet pills buy Maxalt where xenical with consult where to buy generic Buspar online without a rx online Valtrex buy equivalent buy Cytotec Proscar online no prescription Valtrex without rx overnight shipping Flomax cheap no rx required canada buy Flomax money buy buying Flomax Prednisone capsule buy cheap Buspar line buy line Orlistat Orlistat buy online in stock Crestor fedex shipping buy finpecia in england canadian pharmacy Cytotec buy finpecia without rx from us pharmacy purchase Valtrex amex online without prescription buy xenical without a prescription overnight shipping prednisone Buy prednisone online overseas buy 200 mcg Cytotec buy Prednisone without rx needed no prescription Buspar with fedex Buspar for sale order valtrex usa How to get perscription of Cytotec buy Amitriptyline online without rx buy Cytotec australia what is Bupropion buy cod valtrex Crestor fedex no prescription Valtrex with free dr consultation buy Buspar tablets without rx order Valtrex overnight order Zovirax for cash on delivery what does Amitriptyline look like finpecia no prior script buy Valtrex in united states online buy cod Zithromax generic Zithromax online want to buy Buspar in usa discount Zithromax prednisone online cash on delivery cheap Crestor usa purchase Crestor no visa without prescription Crestor on line Buspar buy how to buy Valtrex online without a prescription cheap prednisone without a prescription buy cheap Prednisone free fedex purchase rx Crestor without buy Valtrex diet pills buy 40 mg Strattera buy next day Strattera Flomax without rx purchase Flomax without prescription pharmacy Xenical generic Cytotec tablets Cytotec where can i buy Zovirax how to get prescription of xenical buy cheap Premarin line buy Premarin without a rx overnight delivery buy Crestor diet pill purchase Amitriptyline no visa without prescription buy Valtrex in the uk buspar no rx foreign prednisone order on line buy Valtrex once a day buy Orlistat usa Orlistat pharmacy buy Valtrex in the uk Buy prednisone overnight shipping purchase Zithromax overnight Cytotec cheap mexican to buy valtrex order xenical overnight cheap purchase Accutane pay pal without rx buy Buspar free consultation Zithromax 250mg overnight no prescription valtrex buy Premarin online with a debit card Buy Accutane online buy discount proscar purchase Zithromax visa without prescription purchase cheap Xenical where can i purchase xenical no rx how to get a Zithromax rx buy Premarin in india buy cheapest Premarin Flomax uk sales buy Cytotec for women uk buy Valtrex in mo xenical cod next day delivery buy prednisone online without dr approval Valacyclovir effects prednisone shipped COD cheap online pharmacy for prednisone Flomax u.p.s shipping cod achat Orlistat buy prednisone without a prescription buy cheap online pharmacy Crestor safety order xenical Buy xenical without a r x Zithromax order online Purchase Accutane online where can i purchase Crestor no rx purchase Cytotec free consultation purchase Amitriptyline without prescription needed buy cheap Valacyclovir without prescription best buy Orlistat buy xenical no perscription cod Nizoral online order buy discount Flomax where to buy generic Accutane online without a prescription Flomax canada purchasing Flomax online without prescription buy xenical next day delivery buy cheapest Orlistatbuy no prior prescription Orlistat no prescriptions needed for Accutane buy Accutane 40mg valtrex mexico buy Xenical online without rx generic Prednisone online buy Nizoral paypal without rx order Proscar without rx needed buy Orlistat line order Accutane usa