AES/Rijndael Encryption

C#, Encryption, Programming, SQL Server, Technology 5 Comments »

I’ve been pretty busy with work lately, but it has been very interesting. The past couple of days I’ve been working with the AES/Rijndael to encrypt sensitive user data in the application I’m currently working on. It has been pretty interesting and has proven to be quite a learning experience.

The main reason it has been a challenge is that some of this data that we’re encrypting needs to be decrypted and searched through for reports. We have already decided on using SQL Server Reporting Services (which I haven’t worked with before) to handle these reports, however there was the question of decrypting these fields through SQL Server. Luckily we should be able to create CLR User-Defined functions to handle this.

I have also spent some time cleaning up the solution. This particular project has been going on for the past year and a half (or so) and has had quite a few hands touching it. I went ahead and organized the projects in the solution and fixed the dependency problems that everyone had been just dealing with for the past year or so. I think taking care of these issues will make my life a lot easier in the long run.

Performance of Different Types of For Loops

C#, Programming 4 Comments »

In an old post I found online here the author asks how you would go about writing a simple for loop. I was bored tonight, so I wrote a simple program to time several different types of loops to confirm which is the fastest at iterating through a generic list, yes… that bored. My list contained 67,108,863 integers.

Here are the results:
Foreach loop: 1185.8ms

int tmp;
foreach (int i in array)
{
tmp = i;
}

Standard for loop: 932.1ms

int tmp;
for (int i = 0; i < array.Count; i++)
{
tmp = array[i];
}

Optimized for loop: 726.1ms

int tmp;
int cnt = array.Count;
for (int i = 0; i < cnt; ++i)
{
tmp = array[i];
}
WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in