Category Archives: Uncategorized

RSA Encryption, Part 1

5
Filed under Uncategorized

I’m always really surprised, disappointed, and a bit gassy over how despised anything involving even the simplest of Mathematics is by most Computer Scientists; the mere mention of the word “derivative” is enough to invoke a cringe of repressed childhood-pain from all but the strongest-willed of programmers. However, even if a ‘matrix’ is nothing more to you than a bootleg DVD you torrented when you were 16, you can still enjoy the limitless pleasure provided by a basic understanding of modern mathematics. In fact, after a few simple preliminaries in modular arithmatic (don’t worry – it’s not nearly as scary as it sounds), the algorithm for RSA encryption is actually incredibly simple – so buckle your seatbelt and put on your thinking cap for today’s magical adventure into the strange and wondrous world of mathematics.

1. Modular Arithmetic
If you are still reading this, then either you were misdirected here by the malevolent Internet traffik demon (which means my monetary bribes are working), or you sincerely want to learn how RSA encryption works, in which case I hope our almighty five-legged overlord takes mercy on your soul as it burns in the deepest pits of hell.

Most programmers are familiar with the syntax
18 mod 5
In case you are not, mod (which stands for modulus) simply gives back the remainder from dividing the left number by the right. Since the remainder of 18/5 is 3, this means
18 mod 5 = 3

In mathematics, the syntax is a bit different. Rather than saying “the modulus of 18 by 5 is equal to some number (ie. 3)”, we say “18 is congruent to some number mod 5." It is just as correct to say “3 is congruent to 18 mod 5” as it is to say “18 is congruent to 3 mod 5.”
We would write this latter statement as 18 ≡ 3 (mod 5).

What we are really saying using this notation is that if we take left-hand of the equation and mod it by 5, then take the right-hand side and mod it by 5, we will get the same thing. When we restrict our world to numbers mod 5 like this, 18 and 3 act like the same number.

This new notation allows us to do some very cool symbol-pushing (all of which, I assure you, is completely valid). For instance, it can be shown that the properties of most normal integer operations – addition, subtraction, multiplication, exponentiation – carry over to modular arithmetic, so that, for example,
xa * xb ≡ x(a+b) (mod n)
It is also rather obvious (and, of course, can be proved) that when adding, subtracting, or multiplying, you can replace one number with another it is congruent to; so, for instance, since 18 ≡ 3 (mod 5),
182 ≡ 32 ≡ 9 ≡ 4 (mod 5)

When working with negative numbers mod n, we find congruencies by simply adding n repeatedly until we get a positive number. For example,
-21 ≡ -1 ≡ 19 (mod 20)
This gives us a new trick to put in our bag for determining (without a calculator) some large numbers mod n:
1910 ≡ (-1)10 ≡ 1 (mod 20)

Cool!

In modular arithmetic, we are usually concerned with only integers; this means that numbers don’t have fractional inverses the way they do in regular arithmetic. That is, there is no number you can multiply 5 by (mod 10) to get 1, since we’re not considering 1/5 a number. Nonetheless, there are certain cases in which numbers in modular arithmetic still have inverses! For instance, notice that 7 * 3 ≡ 21 ≡ 1 (mod 10), so 7 and 3 are inverses (mod 10).

For a final example to show just how powerful modular arithmetic is, let’s calculate the last decimal digit of, say, 3403. Notice that “the last decimal digit” is the same as “its value (mod 10).” Hence, we’re looking to reduce
3403 (mod 10).
The solution is actually quite simple. First, we realize that
34 ≡ 81 ≡ 1 (mod 10)
Then, since 3403 = (34)100 * 33,
3403 ≡ (34)100 * 33 ≡ (1)100 * 33 ≡ 27 ≡ 7 (mod 10)
Thus, in less than a minute, we just determined that the last digit of 3403 is 7, without a calculator!

Go on to part 2…

A number has a unique inverse (mod n) if and only if it is relatively prime to n. The concept of “relatively prime” will be briefly discussed in the next post.

That New Car Smell

5
Filed under Uncategorized

My friend Nephtali (yes, like the Egyption queen) recently turned 30, so to celebrate, he bought himself a car for when he gets his license:


Ain’t she a beauty? (click to enlarge)

However, there’s something you should know about Nephtali: he likes to customize everything. That was his car a week ago. Here’s his car today:


Ain’t she a beauty? (click to enlarge)

He sent me those pictures and I thought they were interesting, so I just thought I’d share.

Really Simple, Stupid

1
Filed under Uncategorized

Hello, my name is Raja, and I have a problem.
Hi Raja.
Thank you. For the past year, I have been struggling with an addiction – a disease – which has been ruining my life at every turn. I lost my job, my wife, and my prized gumball collection because I kept telling myself I didn’t have a problem. Also my dog died. I used to insist that I could quit anytime I wanted, and would sometimes give it up for brief periods; however, my hiatus would inevitably be cut short, and I would always end up being drawn back to it, unable to free myself from its wicked, tyrannical grasp. And now Sparky is dead.
My name is Raja. And I am addicted to RSS Feeds.
*Applause, hugging, and crying*

 

Though I’m sure most of you are already aware, for those of you who aren’t, an RSS feed is a thing that enables you to check for updates from all your favorite sites (that support it) in one place. RSS feeds are viewed through an RSS reader – I like Google Reader:


What Google Reader looks like after neglecting my feeds for a day (click to englarge)

  There are lots of different RSS readers out there, some of which even download your feeds and allow you to read them offline – even Internet Explorer 7 has its own (crappy) RSS reader! You can find tons of them by simply googling RSS reader

 

Once you have a reader picked out, adding a feed to it is easy. For instance, to subscribe to a feed using Google Reader, simply hit Add Subscription and paste the link to the feed. Links to feeds can usually be recognized by one of the following images on a webpage:

In addition, some pages also hide a link to the RSS feed in the source-code. For some reason, Internet Explorer does not support these types of links; however, in Firefox, the link is given directly in the address bar:

 

Once you have feeds from all your favorite sites, they are updated automatically in the reader – all you need to do is come back to check on them every once in a while.


An example of what a feed looks like

 

That’s all there is to it – now you too can share the the joys of this terrible, debilitating affliction. Here are some feeds to start you out:

0
Filed under Old blog, Uncategorized

09-f9-11-02-9d-74-e3-5b-d8-41-56-c5-63-56-88-c0

Paranoia

0
Filed under Old blog, Uncategorized

If you’re not careful, you’ll catch it too

The other day, I caught the flu.  For those of you unsure, here’s a list of its symptoms:

  • flu-like symptoms

I told this to my girlfriend, who googled these symptoms and became immediately convinced that I had the West Nile Virus.  Meanwhile, my parents, certain that it’s only possible to catch a flu during the Winter, did some research of their own and concluded that I had “prostatitis,” despite the fact that I only had one of the diseases’ five symptoms (and I quote:  “flu-like symptoms”).

At first I thought my family had just lost their minds, but as I was preparing to have them institutionalized, I happened to accidentally change the channel to a local news station.  Within fifteen minutes, they had me convinced that I was going to die of SARS, West Nile, Ebola, Bird Flu, Mad Cow Disease, Smallpox, Anthrax, and E. Coli, after being stung by a swarm of African killer bees, stabbed through the heart by a stingray, having my leg bitten off by a shark and my house blown down by a hurricane, being raped and murdered by a serial killer, blown up by a terrorist, and dying of cancer from typing this with a laptop near my genitals.
All at the same time.

According to my calculations (which are so complex that if I even began to try to explain them to you, your head would explode), there is exactly a 0.0% chance of any of my readers dying from any or all of the above diseases/catastrophes.  However, the chances are much greater of one of you dying from obesity, a drug-related gun shot wound, or, for those of you who have had sex and are here by mistake, AIDS.

So, in conclusion, I offer you some hurried and poorly-transitioned advice:  put down the pork rolls, turn off the TV, and get some exercise, you fat bastard.

Civilization

0
Filed under Old blog, Uncategorized

a brief monologue by BlueRaja

  Here we are: the water aisle.  I don’t understand why they’d need an entire aisle for water – how many kinds of water could there possibly be?
  Oh gosh, look at all the different flavors.  I never thought I’d see the day when people would pay money for flavored water…and look, this flavored water is carbinated.  How is that any different from diet soda?
  Wait, isn’t this that stuff that CNN said caused cancer?
  Okay, back on track, Raja; you’re here to buy some water.  Just normal, plain old water.  Now where is it?
  Well, here’s some “Spring Water” – that sounds farly clean.  But what is this?  “Purified Water.”  Don’t they purify the stuff that comes from springs?  Is this non-spring water that’s gone through the same process?  What about this “Distilled Water?”  Is that any cleaner than this purified water?  I wonder if it comes from a spring.
  Hey, look.  This container says “Drinking Water.”  Does that mean the other waters weren’t for drinking?
  Wait, isn’t drinking water free?
  Maybe I’ll just get some of that flavored water.  I’ve always wondered what it would taste like if someone genetically mixed water and cherries, if water had genes.
  But, I don’t want cancer…I heard on CNN that it’s not very good for you.
  I wonder if they purify the water before they add the flavors to it…
  Perhaps I should just get the drinking water.  After all, I do intend on drinking it..but, what if it’s not pure?  What if it’s not safe to drink?  I could take a bottle of mercury and label it “drinking mercury;”  that doesn’t make it any safer to drink.. what if the drinking water is just the purified water that wasn’t pure enough to pass all the pure water tests?  And what the hell does distilled mean?
  Maybe I’ll just get a can of soda.  Yeah, that sounds safe.  A nice, air-tight can of soda.
  Hmm…but according to the label, the number one ingredient is “water.”  That’s it.  “Water.”  What if it’s not pure water?  What if it’s actually pond water?  What if Coca-Cola takes the water that’s not pure enough or springy enough to be Dasani and uses it for their sodas?
  AHH!!! To heck with this, there are just too many choices here; I’m going to the coffee aisle instead.

0
Filed under Old blog, Uncategorized

Dear Blog,
   I really wish I had time to pay more attention to you; however, the constant onslaught of video games, movies, and late-night pizza that college has provided me with has not only stinted my creativity, but left me with very little time for the more important things in life, such as you.  I wish I could tell you that I still love you the way I used to; I wish I could tell you that you still bring the same joy and excitement that you have in times past.  However, things change, and I’m not nineteen anymore:  I’m nineteen-and-a-half, a huge difference in the eyes of the real world.  Perhaps in another life, things could have turned out differently… but it’s too late for that.  I wish for you not to look into the past, and what could-have-been, but towards the future, and what will-be.  Don’t let my leaving you be a thorn in your side; rather, let it be an inspiration to do better in times to come, and to be a better person…er…weblog.
   In closing, Blog, there is really only one thing left for me to do before we part.  The one thing, the only thing, that any kind, decent, loving American male could do to help another in need:  I leave you, Blog, with only a picture of two large, succulent boobies.  May it help you to pass the time well.

Good bye Blog…

0
Filed under Old blog, Uncategorized

Just coming back to obliterate my childhood.

0
Filed under Old blog, Uncategorized

Don’t you just hate people who update simply for the sake of updating?

Teach a Man to Fish

0
Filed under Old blog, Uncategorized

and he’ll shoot at you and steal your boat

Recently, a friend and I were having a deep-rooted philosophical discussion, in which we came to two conclusions:

  1. I must be the only college student who manages to keep an online blog without simultaneously juggling a serious mental-retardation problem; case and point.
  2. h01y 1337 0n3:  Hm.  Maybe this is more a problem with blogrings than it is blogs…
    h01y 1337 0n3:  I mean, really.  It’s wholly insane to sign up for a blogring to meet people who go to the SAME SCHOOL AS YOU.
    h01y 1337 0n3:  How about just going to class, you fools.

  3. The only two things that have been in the news for the past week have been gas prices and dead Southerners.  Here’s my thought:  why not create a vehicle that runs on dead Southerners?  This has the added bonus that, once we’re out of dead Southerners to run on, we could always make more.  Hell, why stop at dead Southerners?  Why not have it run on dead people in general?  We could even throw in aborted fetuses.  Look at that; I’ve just solved the problems of high gas prices, teen pregnancy, and overpopulation in one fell swoop.  I should be getting paid for this.

    Seriously, though; civilians shooting at aid-workers?  Large groups of men raping women?  Large-scale rioting?  What the hell is the matter with you people?  Nothing like this happened after the Tsunami, during the NY blackout or after 9/11 – whatever happened to American pride and isolationism, to “we can handle ourselves because we’re better than everyone else?”  If these are the people that are starving to death, then I say, good riddance; I’m running low on aborted fetuses anyway.

[edit: Score.]