Skip to main content

Final Project Part 01 - Finding an Open Source Package

The final project of this course has been split into 2 major parts, the first part is as follows:
  • Find an open source software package with a hash or checksum function that compiles to machine code.
  • Benchmark the performance on an AArch64 system.
  • Identify how you plan to optimize the function.
 It turns out that finding the open soure software package took much longer than expected. Typing in google some combination of "open source software with hash function" clearly produces nothing. These were the strategies I employed below to find my package:
  1.  Reverse search using Wikipedia.
  • Start here at the list of hash functions.
  • Pick one, look at the External links and References sections for an implementation that is open source.

      2.  Install open source packages from the Free Software Directory here.
  • Pick a package and use wget on our AArch64 system if applicable.
  • grep -Ri for hash/checksum and see if it returned anything useful.

      3.  Google search "(hash/checksum) hash c".
  • Search through approximately 5 pages per result to see if any packages appear.

Ironically, although option 1 followed by 2 sounds the most probable to find a package, option 3 brought me to the package I chose. Wikipedia unfortunately offered only plenty of information regarding the way the hash works or it's vulnerabilities and very little on any implementations. Option 2 after many packages began to feel hopeless and the descriptions give you no indication of whether you will find a hash/checksum function in them. After typing in sha1 hash c I came across clib here.

Comments

Popular posts from this blog

Final Project Part 02 - Sha1 Function Enhancements

To try to squeeze out a bit more performance I attempted to some compiler optimizations. Unfortunately, due to the sheer complexity of the algorithm, I was unable to find other logic complexities to simplify. I tried some loop unrolling to make the compiler have to work a little less, some examples are here below: I made a graph to demonstrate the minute differences this makes in the test vectors below: At most a few millisecond difference is all that can be acquired, and this is only from the finalcount[] array as the digest array produces errors if not compiled in a loop along with other for loops in the code. To test this I simply altered the sha1.c code and ran the make file to see if the vectors passed or failed. As mentioned this is a compiler optimzation, in other words it is completed already, especially at the -O3 level where the benchmarking was done. I would not  recommend this change to be pushed upstream normally due to the insignificant time ch...

Inline Assembler (Lab 7)

Part 1 After given an Inline assembler version of the volume program I made in the last lab, I got some results that shocked me. After running it with the same 500,000,000 sample size It took only 1.2 seconds of computing time, which is better than even the best variant (bit-shifting) of the program I had made by over 50%. I answered some questions below to further my understanding: 1. What is another way of defining variables instead of the (type name register) format? This can be done using normal type variables as the compiler will automatically put values into registers. 2. For the line vol_int = (int16_t) (0.5 * 32767.0); should 32767 or 32768 be used? 32767 should be used because the int will round the value and 32768 is not in the int16_t range. 3. What does __asm__("dup v1.8h,w22"); do? The duplicate simply means copy the int value into a new vector register . This is for SIMD instructions. 4. What happens if we remove : "=r"(in_cursor) ...

Final Project Part 02 - Final Summary

In conclusion, the -O3 flag was the most important discovery with trying to optimize clib. It offered a significant speed up with no interference, and provided the chance to uniform a many times used function, strdup. Overall the function is built extremely well with very advanced logic. Attempting to alter said logic sprouted many errors and warnings and left only simple compiler optimizations such as loop unrolling which made small differences in speed up. Clib as a whole is a great idea, offering many compartmentalized features for the C programming language that programmers could definitely find useful when developing. I hope in the future I can get more involved in writing code for open source projects such as clib whether that be doing optimization work or building from the ground up. This project not only gave me an insight on how these open source projects work but also at real world coding and improvement opportunities. I can honestly say now that I have had some experience ...