5.15.2009

My love for RSS

If you are a computer programmer, software engineer, web developer, systems architect or vice president of anything in technology, you should know what RSS is and use it everyday. I would even go so far to say that if you are breathing, can see, and are able use at least a one-button mouse, then you should be using RSS. Trust me, it's really simple.

The following is a list of blogs that I follow. This is my personal list. Please don't confuse it with anything other than that. In no way do I endorse the opinions or viewpoints of these blogs. My lawyer told me to include that. Feel free to pop the urls into your RSS reader and start running.


For technologists, it's important for us to continually learn in an ever-changing technical world just as any CPA would have to keep up with the latest tax loopholes in an effort to keep his client from short selling his $1.5 million yacht. I mean, hey, it's tough times these days. But seriously, how do you keep up with the latest programming languages, frameworks, and any other arbitrary acronym without RSS?

5.14.2009

Beginner & Advanced Unix/Linux

For a beginner's guide to Unix/Linux, take a look the UNIX Tutorial for Beginners. It covers everything you need to know to get started, e.g., files, directories, file security (access rights), processes and jobs, and the Makefile. It even has pictures! This is the perfect primer for the brand new computer science student, or even for the Windows guru who has had no exposure to the o/s. Make sure to bookmark it for future reference, people!



CodeSourcery, a proponent of open-source software, created Advanced Linux Programming published by New Riders Publishing. From experience, when any type of publication has "Advanced" in the title, it usually means business. And yes, this business does deliver 24/7. When a book can show me when and how to write an inline assembly instruction, that's when I go home and cry to mom. If you're a language head, and want to know more about processes, threads, and system calls, this just might be what you are looking for. It certainly is priced perfectly. For those of you interesting in security in operating systems, Chapter 10 discusses Buffer Overruns and Race Conditions.

5.13.2009

Affine Cipher written in C#

The following code written in C# encrypts and decrypts using the Affine Cipher. For more information, check out Making, Breaking Codes by Paul Garrett. All questions/comments are always appreciated.



///
/// This function takes plain text and encrypts it using the Affine Cipher
/// e(x) = (ax + b)(mod m). Note: a & m should be coprime.
///
public static string AffineEncrypt(string plainText, int a, int b)
{
string cipherText = "";

// Put Plain Text (all capitals) into Character Array
char[] chars = plainText.ToUpper().ToCharArray();

// Compute e(x) = (ax + b)(mod m) for every character in the Plain Text
foreach (char c in chars)
{
int x = Convert.ToInt32(c - 65);
cipherText += Convert.ToChar((( a * x + b ) % 26) + 65);
}

return cipherText;
}

///
/// This function takes cipher text and decrypts it using the Affine Cipher
/// d(x) = aInverse * (e(x) − b)(mod m).
///
public static string AffineDecrypt(string cipherText, int a, int b)
{
string plainText = "";

// Get Multiplicative Inverse of a
int aInverse = MultiplicativeInverse(a);

// Put Cipher Text (all capitals) into Character Array
char[] chars = cipherText.ToUpper().ToCharArray();

// Computer d(x) = aInverse * (e(x) − b)(mod m)
foreach (char c in chars)
{
int x = Convert.ToInt32(c - 65);
if (x - b < 0) x = Convert.ToInt32(x) + 26;
plainText += Convert.ToChar(((aInverse * (x - b)) % 26) + 65);
}

return plainText;
}

///
/// This functions returns the multiplicative inverse of integer a mod 26.
///
public static int MultiplicativeInverse(int a)
{
for (int x = 1; x < 27; x++)
{
if ((a * x) % 26 == 1)
return x;
}

throw new Exception("No multiplicative inverse found!");
}