Extensions for the Fritz!Box Plugin for Homeseer

It has been quiet regarding the Fritz!Box Plugin for Homeseer for a while, but that’s going to change; when others start creating scripts around my Plugin then you know there’s something missing and it’s time to have a look at it…

The last couple of days i was looking at how i could spend the huge amounts of free time i have lately and decided to spend it on extending the Plugin with some extra features; the Fritz!Box has a lot to offer, so there are still a lot of things to explore.

But first i had to tackle the new way of logging in to the Web-interface that has changed in the recent firmware versions (xx.04.74 and higher). This new method of logging in involves calculating MD5 value based on a challenge provided by the Fritz!Box, and having read once that a lot of faulty MD5 routines exist, i decided to look into that issue first. I mean, creating additional functionality without supporting the latest firmware sounds rather stupid to me.
OK, the sequence of actions to do a successful login were clear to me, that wouldn’t be the problem; only thing i hoped for was that the calculation of the MD5 hash would succeed with the .NET provided classes/routines. So i created a simple function that could return the MD5 of a given string:

MD5-Hash

The resulting md5bytes should contain the correct hash value when each byte was written as hex string value and all 16 of them were concatenated. But something strange was going on…

The AVM documentation stated the resulting MD5 should be: 9e224a41eeefa284df7bb0f26c2913e2 And what did i get? 58224a41eeefa284df7bb0f26c2913e2.

What’s this… well OK, it’s almost the same, maybe it will work, lol.
On the contrary, this ain’t funny at all of course… what’s going on here ??? I just didn’t know what was wrong; was it the encoding? The AVM guideline speaks of UTF-16LE (LE = Little Endian), BOM, trailing 0-bytes, Codepoints; not really the stuff i deal with on a daily basis, so …??

Searching MSDN i found this:

Not mine

With just a tiny adjustment (there where the cursor is) and it worked…

I still don’t understand why; these things can really bug me and now i’m struggling to either just go on and let it be, or go to the bottom of this?

Let’s hope i don’t encounter to much of these mysteries..  🙁

Tagged , , . Bookmark the permalink.

One Response to Extensions for the Fritz!Box Plugin for Homeseer

  1. Dennis van Velzen says:

    lol! There must be a reason “9e” / “58”… Maybe raw bytes will reveal the encoding issue.

    But why .default will work? — Again: lol!

    If I ever face a similar issue I know were to look first 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *