JKISoftware / JKI-State-Machine-Objects

Object-oriented framework for LabVIEW based on the JKI State Machine
BSD 3-Clause "New" or "Revised" License
95 stars 54 forks source link

Speed improvement for computing shared keys #66

Closed francois-normandin closed 3 years ago

francois-normandin commented 4 years ago

There are two instances of computing what could be dubbed as private and protected keys in the SMO framework. Those keys are used to prevent hacking features in the SMO framework that should not be exposed. For example, it prevents a SMO to use its protected API to stop another SMO when only the initial caller should be allowed to stop a dependency. Those calls have been initially made to create a strongly-unique key so that it could not be inferred by other instances of SMOs by random chance. It uses MD5 hashing to create unique identifiers shared by a caller and a callee or known only by the registry.

Over time however, the features that were supposed to be called only at registration started to be called more and more often in the normal operation of the framework. As it is, the computation is absolutely inefficient for such a purpose, as can be seen in the screenshot below:

image

The proposal is to remove the for loop altogether, thus gaining a lot of efficiency. Going through all the calls for this private framework node, it will be completely impactless on functionality to have a single pass at the hashing function. It will save a ton of computing cycles which can cause a lot of delays if using a certain subset of nodes.

francois-normandin commented 4 years ago

By the way, the reason for multiple passes is to be a little more immune to "rainbow" attacks. You can imagine how useless it is to prevent this when considering that a) the code is open source and b) the cost to prevent a developer from misusing the framework is high compared to the actual benefits.

francois-normandin commented 4 years ago

This will be implemented in the 1.4.0 release.