SHA1 hash generation in plugin corrupt in Android app

I am using a SHA1 hash generator to generate the hex string for login to the Vera remote server for the Datamine plugin (likely same approach as the Vera devices are using). This all works fine on the Designer and the SHA1 hex string is correct generated, but on the Android app the SHA1 hex string becomes corrupt. I am using an verified javascript SHA1 generator (sha1.js as attached).sha1.js (9.1 KB). For example in the Designer a call to the SHA1 generator => hex_sha1(“abc”) correctly generates “a9993e364706816aba3e25717850c26c9cd0d89d”, Same call on the Android app generates “00003b8a1ff1f9045d3275aa10326beb1cf1f62a”. This is at the moment the stopping point for the plugin. Can also be tested with the attached test case : sha1.hrp (99.7 KB)
Any idea on what goes wrong?

I can look at it, but I think most people would be happy to see what you have working for a local connection. In general, people are mounting tablets inside their homes. So please, if you could share that.

I have prepared a plugin setup but as I am runnning my installation remote to my summer house, remote is my key debugging environment. I have tested the plugin also local earlier so it should work but the test setup I am preparing I would prefer that I can test so I know it’s a good starting point. Appreciates if you can look into it, but if not resolved I will release the beta version for the plugin shortly anyway.

One further question: HR most likely have a SHA1 generator in C++ in the native integration of Vera devices. Would it be possible to call this function from a plugin/javascript? Would this be a possible enhancement?

Yeah. I’ll add a new “sha1” function for you in the next release. I’ll model it after this PHP sha1 function. You give it a string & it’ll return a hex number string. It’ll call the same function the official Home Remote Vera integration is using.

https://www.php.net/manual/en/function.sha1.php

https://www.w3schools.com/php/func_string_sha1.asp

Wow, you keeps impressing me :grinning:. Great news.

1 Like

The 4.1.3 release is available to test. It has the sha1 function.

Have tested sha1() function and it works perfect - now remote login without hardcoded SHA1 hash is in place also for Android. Thanks for this Bill.

Have spent last days getting a local installation up and running to test both local/remote. Found some minor bugs in my code but should have a first beta plugin code available after some further testing during next weekend.

1 Like