intrbiz / arduino-crypto

A minimal crypto library for ESP8266 Arduino
Other
140 stars 54 forks source link

Bug fix. doFinal only calculates SHA256 correctly the first time. #28

Open macsnoeren opened 3 years ago

macsnoeren commented 3 years ago

One of the issues is that the doFinal function calculates only the correct SHA256 the first time. After that, the hashes are wrong. The problem is that the state variables of the classes are not resetted. Therefore, doFinal calculate the next hash using the wrong state values. I have fix this by adding a reset function, that resets these state variables. At the end of doFinal the reset method is called and all next hashes are correctly calculated!

I hope you like this fix!