-
• #2
Update: a few '& 0xffffffff' have solved the problem.
OTH, while googleing along I found that Espruino has an internal MD5 implementation. Would it be hard to expose that one to the JS level?
-
• #3
Hi Stev, Where did you find mention of an MD5 implementation? I'm afraid Espruino doesn't have one...
Shame about the overflow - Espruino uses 64 bit ints wherever it can and it seemed a real shame not to expose that rather than masking everything down to 32 bits - but I suppose some people write code that relies on it :(
If you have a working MD5 implementation do you think you could write a module for it - or at least post the code up so that I can?
thanks!
-
• #4
Hey Gordon,
Sorry, seems I didn't get a notification on this early discussion.
I found md5 in the target libs like here: https://github.com/espruino/Espruino/blob/master/targetlibs/stm32f2/lib/stm32f2xx_hash_md5.c
I'll see if I can (license-wise) use the code I grabbed for providing a module. Still hoping that the link above might lead to having a single JS line instead of filling up the precious JS mem, though :)
Stev
-
• #5
Also very interested in this, and ran across the same code.
Since there is no HTTPS, I'm interested in HMAC SHA1 to sign HTTP requests to our REST API. Similar to how Amazon does it here: http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html
I've done this in the past and it works real well if you cannot implement HTTPS; and given that your data is not sensitive. Just a little measure to keep any private API less public.
Would love if this was opened up to a class or function we can use.
-
• #6
I'm afraid that is just part of ST's library for the STM32F2 (it's not the chip that Espruino has) - it doesn't itself contain an MD5 implementation, it just uses some hardware on the chip.
Coming up with a JS module is probably preferable (unless you can find a very small C implementation) - IMO less than 1% of Espruino's users would use it, so it's debatable whether its worth using up precious flash for.
-
• #7
Hm. I'll look into the lib thing and try to make an external module for swapping it in and out from the SD card from it as described in that 935 thread. Otherwise the mem footprint seems not feasible.
I still (or now) wonder if having an STM with crypto capabilities as an option for Espruino might not make sense in the long run. Especially if I consider the discussions on TSL, HTTPS etc and the current state of network modules (hardware). If I stay in my own realm, not having https might not be that much of a problem. However, once I want to connect to other's APIs it might get more important/necessary, and even more so after NSA's work makes many providers tighten their services' security these days.
-
• #8
I've heard that there's a new TI CC3000-type chip out that directly supports HTTPS, so that won't be an issue for Espruino at all.
IMO MD5 implementation would be fine running as a JS module - I really don't see there's much need to swap it in when you need it. It doesn't look too large: http://rosettacode.org/wiki/MD5/Implementation
Hi,
I'd like to do a MD5 on some data. Unfortunately all the libs I tried return wrong hashes.
Is there any working implementation of MD5 for Espruino? If not, what should I look for on the "differences" part of the JS implementations (I though endianess first, but maybe there are better hints)?
Cheers
Stev