Monday, February 28, 2011

FIPS compliant algorithms

Hi guys!

Distributed software
If you're building and distributing a software/product, you must be aware that some of the Encryption algorithms of the .NET Framework are considered "FIPS approved" (Federal Investigation Processing Standards) and others aren't.

What problems can cause this? Well, if you're using MD5 in your distribution and your customer is running your software on a machine configured to ensure FIPS, your software won't be working.

For instance, in Windows there is a setting called - "System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing". Enabling it, ensures that all applications on the PC are using algorithms which are approved by FIPS.

FIPS approved algorithms list
It's a good idea, to always check the Encryption algorithms you're using against the list of approved FIPS algorithms:
https://wiki.mozilla.org/FIPS_Validation

This way you'll ensure your software robustness and reliability.

More resources

http://csrc.nist.gov/groups/STM/cmvp/standards.html#02

http://technet.microsoft.com/en-us/library/cc780081%28WS.10%29.aspx

Monday, February 21, 2011

Little victories make up the big victory

Hi guys!

This will be my first blog post, not directly related to problems, code snippets and etc. I hope I'll write more like these in the future!

Code refactoring
In our daily work we frequently do refactoring. Sometimes we do some pieces of code refactoring, which we enjoy as we see the code becoming better and better and we feel happy and satisfied about that. But sometimes, we have to refactor something bigger, some spaghetti code with much legacy in it.
I've encountered such case recently. I struggled with it for few days and was highly disappointed by my performance.

Don't underestimate your tasks
I was frustrated as nothing was working. I've taken a wrong decision to cut-off the whole project I wanted to refactor and rewrite it. Thinking it will be an easy job to do, I didn't pay much attention, neither estimated accurately all the functionality I had to cover.

What happened was that it turned out to be tougher than expected. I had erased everything old, the whole solution couldn't be build. I couldn't even cover all the functionality, yet. This all happened for few days in which I've been feeling miserable. It was a dead-end thing and I haven't felt that way for some time. I was close to resigning from this task, as the deadline was coming closer and I was becoming more and more heartless. But admitting that you have failed with a task is something hard to live with (at least for me).

Don't lose hope, change directions
Then, I decided to change completely my plan I've firstly tried to follow. I commented most of the code I haven't refactored yet and struggled with building the other code. I've spent few hours on this, but finally built the project (Victory 1). I've started testing and bug fixing (Victory 2..N). It was such a relief. This whole system was alive and beating again!

Get motivated, get the work done
I saw a light in the dark - this whole thing might start working. Fully motivated, I continued iteratively refactoring the remaining part of the project. This took me some time, but in the end, everything was fine and I was satisfied with my work.

The moral of this story is, that when firstly I got my project built successfully this was actually my first victory - and it felt great. When I started testing, bug-fixing and improving my code I achieved my next victories. From this time on the job was easy to do.

Small victories, make up the big victory
Sometimes, you need to get to the small victories as fast as possible, to have the power and motivation to continue until you win the battle.

Learn from your mistakes and don't repeat them
Next time, I'll certainly pay more attention to the details, estimate them and try to iteratively do things, not taking them all at once.

Keep tuned, for more stories of failures and successes!