Blog

How to use javascript to fix IE CSS problems

ie7-js is a JavaScript library that makes Microsoft Internet Explorer behave like a standards-compliant browser. It's released under the MIT license. I used it on a website to fix IE's :hover problem and it worked pretty well. It also fixes the PNG transparency problem on IE6 browsers.

The downside is that the visitor needs to have JavaScript enabled, but that's not a big problem if your goal is to make your website work with IE6. Someone running IE6 is probably also running it on its default settings. Otherwise, they would be running IE8 or Firefox.

Google Take Me Away

There are rumours that Google is creating another social media website, called Google Me. There is an article about it on PC World and Kevin Rose talked about it on TWIT episode 254. Looks like Kevin Rose tweeted about Google Me and was asked by Google to remove the Tweet.

What about Google's current social website, Orkut? I think it will be merged into Google Me or become Google Me. Maybe it will be same social website, but with two names: Orkut and Google Me.

Facebook is no longer cool. Recently, my wife's cousins were teasing each other on their wall and their mother ended the teasing by posting something like "now girls, remember you only have each other." These "girls" are in their mid 20's and early 30's. To me, that's the point when Facebook jumped the shark.

Facebook is no longer behaving like a true social network. Once you have everyone mixed in the same conversation (family, friends, significant other, boss, co-workers) we either shut up or just talk about the weather and sports. I have noticed that the wall postings in Facebook have become unimportant nothings and some people have stopped posting.

Google Me is coming in at the right time. I'm ready to leave Facebook. Google Me, take me away!

UPDATE (2015/08/10): So what happened 4 years after writing this blogpost? I was wrong. Facebook did not jump the shark. Google Me is Google Plus. I'm still using Facebook because most of my family and friends is using Facebook. Most of the Facebook postings are still unimportant nothings, but there are also very important somethings. I also realize the importance of unimportant nothings because they are like chit chat with friends. Some of my friends and family are also in Google Plus, so I use both Google Plus and Facebook. Orkut has been closed.

Simple XOR Encryption Program in C

At the bottom of this blog posting, I include the source code and executable for a simple XOR encryption program I wrote many many years ago. It's written in C and the executable runs in Windows. The program takes two files. A message file, a key file, and creates an XOR encrypted file. The message file is anything you want to encrypt. The key file is any file you want to use as the encryption and decryption key. Remember that secure XOR encryption requires a random key that's at least as big as the file to be encrypted. If you meet those requirements the message is IMPOSSIBLE to decrypt. I truly mean IMPOSSIBLE. The reason is that with XOR and a random key, the message could mean one thing or another depending on the key you try to decrypt it.

Let's say the message you want to encrypt is "YES" and you use this key "1AP". The message represented as ASCII binary values of Y, E, and S can be represented in 3 bytes:

Y = 89 (decimal) = 01011001 (binary)
E= 69 (decimal) = 01000101 (binary)
S = 83 (decimal) = 01010011 (binary)

In binary, the message to be encrypted is: 01011001 01000101 01010011

The key is "1AP". Its ASCII values are

1= 49 (decimal) = 00110001 (binary)
A = 65 (decimal) = 01000001 (binary)
P = 80 (decimal) = 01010000 (binary)

In binary, the key is: 00110001 01000001 01010000

The XOR operation results in a 0 when both binary numbers are 1 or 0, otherwise it returns a 1. Like this

1 XOR 1 = 0
1 XOR 0 = 1
0 XOR 1 = 1
0 XOR 0 = 0

So, the XOR of the message and key are:

message: 01011001 01000101 01010011 (Y, E, S)
key: 00110001 01000001 01010000 (1, A, P)
=======================
encoded: 01101000 00000100 00000011 (h, EOT, ETX)

Which in ASCII is h, EOT (end of transmission character), and ETX (end of text character). To recover the original message, you just XOR the encoded message with the key:

encoded: 01101000 00000100 00000011 (h, EOT, ETX)
key: 00110001 01000001 01010000 (1, A, P)
==============================
message: 01011001 01000101 01010011 (Y, E, S)

Let's say someone wants to use brute force to determine the original message. He will find that "1AP" decodes the message as "YES" and "fK-" decodes the message as "NO."

encoded: 01101000 00000100 00000011 (h, EOF, EOT)
new key: 01001110 0100 11 1 1 001 01110 (f, K, -)
========================
message: 01100110 01001011 00101101 (N, O, .)

Another key will decode the message as "123" another key will decode is as "ABC". There's no way to tell with is the real key and the real message. If the key is not random, then the person trying to decrypt the message will find certain patterns that will indicate he has found the correct key.

Here is the source code in C language. Here is the executable for Windows. Beware that if you lose the key you will never be able to recover the original message file.

Pages

Subscribe to RSS - blogs