This week, I was given a task to write a driver for the Secure Hash Algorithm 1 (SHA-1), which ultimately produces a 160-bit of hash value. It wasn’t as simple as I thought it would be as it’s quite different from the drivers that I wrote earlier. Apart from understanding how’s the communications between the driver and the accelerator,  I also had to learn how to utilise inline-assembly in  C/C++ codes, which has taken up quite a lot of my time. Among the 4 functions (setSHA1(), getSHA1(), statSHA1() and cfgSHA1()) that I had to implement, I think setSHA1() function was the most complicated one as there were more conditions that I had to consider when coding and it was not as direct as the others. In this function, I had to write to the data register of the accelerator when the user wants to send a file to the device. The writing process includes sending the data in blocks of fixed bit and appending the data in the last block before sending.

This week was a short but meaningful as I was able to learn something new again and I had to keep pushing myself to quickly absorb the new concept. I was trying quite hard to complete this task within 3 working days, but it wasn’t that easy as a lot of thinking was needed, especially for the setSHA1() function. There is still a little of work that has to be done for this task and I will try to complete it during the weekends so that I can hit the ground RUNNING next week.