SHA-1 <> Netlinx
ericmedley
Posts: 4,177
I'm choosing my words carefully.
can anyone think of areason(s) why one could not do SHA-1 in a Netlinx program?
If not, could one do it in a DUET module?
I'm speaking specifically of making a single string, not continuous communication.
Thanks
E
can anyone think of areason(s) why one could not do SHA-1 in a Netlinx program?
If not, could one do it in a DUET module?
I'm speaking specifically of making a single string, not continuous communication.
Thanks
E
0
Comments
If you decide that you want to roll it in NetLinx (not recommended) there's a couple of functions in the NCL math libary that may be of use for lshifting and rshifting 32 bit values as well as deconstructing doubles into a pair of longs for manipulation and vice versa.
If you've access to Duet and are comfortable working with it I'd go down that path. We had this option also, but chose to build the algorithms in Netlinx for various reasons.
If you do choose to roll your own in Netlinx land, be careful about the distinction between bit and byte counts in calculations especially if porting from a Javascript implementation. Two of us wrote Netlinx functions separately, one from the specification and one by porting JS code, and had the same bug in both implementations which took a while to track down. From memory it was related to bits being counted when it should have been bytes or vice versa.
If you do decide to have a go at it, do a comparison of the various online calculators first to find one that actually works properly. I found some would truncate your input (e.g. to 200 chars) before hashing, which obviously results in a radically different result. I think (but can't remember exactly) that others would modify your line endings (CR vs CRLF vs LF) before hashing, which would also end in bogus results.
Roger McLean
Swinburne University