Monthly Archive for March, 2009

Page 2 of 3

Backup : Ubuntu Intrepid

Well, when it comes to twidling around with Linux installation, I am a newbie. Usually my experiments end up with me not knowing how to reverse the side effects. I have no choice other than to live with the problems created. But periodically I have to do a complete reinstall of my system to keep it running well (also because after a certain point I cannot bear to see all the broken application, dead links and innumerable errors). Earlier it was a pain to do complete reinstall, because I would lose all my configuration files unless I explicitely saved them. Thus began my search to discover a backup tool for ubuntu.

I stumbled across this thread which says that all you need to do is to make a tar of all your files, thus saving the present state of ubuntu. If a restore is required, just expand the archive. This can be done on a running system too. Just restart after the exoansion is done, and the ubuntu gets restored to its state when the zarchive was created.

However, archiving all the files requires a lot of space. Also it takes time to everytime archive all the files. An alternative option I came across was to sync the files. I have used this method to create a backup of all my files. Sync is much faster than creating tar archive because sync only copies the files that have been modified since the last sync operation.

I have opted to backup only my /home/anu folder. This is what needs to be done.

rsync -av /home/anu /media/Downloads/syncUbuntu

rsync is the command used to sync the files. /home/anu is my user directory. I have an externally mounted USB drive. It shows up in /media with the label Downloads. I have created a new folder syncUbuntu within this drive to contain my sync files. Now all I have to do is run the above command and my files get sync with the files already present in the syncUbuntu folder.

The first time that you run the command takes time as all the files have to be copied. However the next time onwards the process requires hardly a few seconds. It is a great way to backup the system. And now I know I have all my files backed up to be called upon whenever needed.

To make the process easier, I created an alias in the bashrc file. I named it backup. This is the line that I added

alias backup=’rsync -av /home/anu /media/Downloads/syncUbuntu’

To backup my files, I now need to type backup in my terminal and I’m done.

Popularity: 1% [?]

Go For The Broke, A Victory Is Everything

The Formula One racing’s governing body has taken the decision to overhaul the current system of choosing the champion to replace it with the medal system as earlier proposed by Bernie. Not many F1 personalities were in favour of the medal system, but apparently a general survey of F1 fans helped take up the decision.

Earlier we had the scoring syste wherein the driver taking the chequered flag is awarded 10 points, 8 to the next, 6 to the third and one less for each position thereafter. At the end of the season, the driver with the maximum points would be crowned the champion.

The basic flaw in this system is that sometimes the drivers are contend settling for 8 points instead of pushing hard for the 10 points. The reasoning always was that 2 points less is still better than no points at all. Also, in the final race of the previous season, where Massa needed to win the race and Lewis to finish 6th or lower for Massa to be crowned champion, McLaren played it safe by having Lewis drive a riskfree race to just finish fifth. That was so not like a champions drive and in my opinion Lewis should be ashamed of himself. Yet, what was done was done.

This incidence prompted Bernie to propose the medal system. In this system, the only criteria for choosing a champion is the number of races he has won, instead of the points he has accrued throughtout the season. In case of a tie, the points shall be taken into consideration. Had this system been in effect the last year, it would have been Massa with 6 race wins as the champion instead of Lewis, who managed to win just 5 of the races.

The advantage of this system is that the drivers now have to go for a race victory. You cannot sit back and let your adversary win while you could have pushed him. The races should now become more interesting, particularly the overtakes amongst the top drivers should increase.

Though I was never in for a lot of rule changes, but all these changes add a new dimension to the technical sport. Everyone starts equally, and all the established rules have been tempered with. Definitely more the reason to watch season. How I await the Melbourne GP.

Popularity: 1% [?]

Output Feedback Mode

[ Sometime the LATEX does not render properly. Just refresh the page and it should do. ]

OFB Encryption

OFB Encryption

OFB Decryption

OFB Decryption

Output feedback mode is similar to CFB mode except that the quantity XORed with each plain text block is generated  independently of both the plain text and cipher text. An initialization vector $$s_0$$ is used as a seed for a sequence of data blocks $$s_i$$, and each data block $$s_i$$ is derived from the encryption of the previous data block $$s_{i-1}$$. The encryption of a plain text block is derived by taking the XOR of the plain text block with the relevant data block.

It is essential for security that the initial value is chosen randomly and independently from the previous ones. This prevents almost with certainty that the same initial value $$s_0$$ is used for more than one encryption.

A transmission bit error in block $$c_i$$ only affects the decryption of that block. The block recovered from $$c_i$$ has bit errors precisely where $$c_i$$ did. However, the output feedback mode will not recover from a lost cipher text block – all following cipher text blocks will be decrypted incorrectly.

The speed of encryption is identical to that of the block cipher. Even though the process cannot easily be parallelized, time can be saved by generating the key stream before the data is available for encryption.

The output feedback mode is implemented by the following algorithm

Algorithm:

bitStream ofbEncrypt(bitStream $$m$$, $$s_0$$)

divide $$m$$ into $$m_0m_1…m_l$$

for $$i \gets 1$$ to $$l$$ do

$$c_i \gets m_i \oplus {msb_r}{({E_K}({s_i}))}$$

$$x_i \gets {E_k}({s_i})$$

return $$c_1c_2…c_l$$

[ This is a part of a series of post on Modes Of Encryption. I had to scribe a lecture as a requirement of a course on the Foundations Of Cryptology at the Indian Institute Of Technology. The scribe has been broken into smaller chunks so that it is easily readable. ]

Popularity: 1% [?]

Cipher Block Chaining

[ Sometimes the LATEX does not render properly. Just refresh the page and it should do. ]

In the cipher block chaining mode, each block of plain text is XORed with the previous cipher text block before being  encrypted. This was, each cipher text block is dependent on all the plain text blocks that have been processed up to  that point. Also to make each message unique, an initialization vector must be used in the first block.

CBC Encryption

CBC Encryption

CBC Decryption

CBC Decryption

CBC mode is as secure as the underlying block cipher against standard attacks. In addition any patterns in the plain text are concealed by the XORing of the previous cipher text blocks with the plain text block. Note also that the plain text cannot be directly manipulated except by removal of blocks from the beginning or the end of the cipher text. The initialization vector should be different for any two messages encrypted with the same key and is preferably randomly chosen. It does not have to be encrypted and it can be transmitted with (or considered as the first part of)  the cipher text.

If the first block has index $$1$$, the mathematical formula for CBC encryption is $$!C_i = E_K(P_i \oplus C_{i-1}), C_0 = IV$$ while the mathematical formula for CBC decryption is $$!P_i = D_K(C_i) \oplus C_{i-1}, C_0 = IV$$

Choosing the initial value $$c_0$$ at random prevents almost with certainty that the  same initial value $$c_0$$ is used for more than one encryption. This is important for security. Suppose for a moment that the same $$c_0$$ is used for two messages $$m$$ and  $$m^`$$ . Then, an eavesdropper can immediately detect whether the first $$l$$ blocks of $$m$$ and $$m^`$$ coincide, because in this case the first $$l$$ ciphertext blocks are the same.

The speed of encryption is identical to that of the block cipher, but the encryption process cannot be easily parallelized, although the decryption process can be.

In this mode, we have $$r = n$$. Encryption in the cipher-block chaining mode is implemented by the following algorithm

Algorithm:

bitStream cbcEncrypt(bitStream m)

select $$c_0 \in \{0, 1\}^n$$ at random

divide $$m$$ into $$m_1m_2…m_l$$

for $$i$$ $$\gets$$ $$1$$ to $$l$$ do

$$c_i \gets E_k(m_i \oplus c_{i-1})$$

return $$c_0c_1c_2..c_l$$

Decryption in cipher-block chaining mode is implemented by the following algorithm

Algorithm:

bitStream cbcDecrypt(bitStream c)

divide $$c$$ into $$c_0c_1c_2…c_l$$

for $$i$$ $$\gets$$ $$1$$ to $$l$$ do

$$m_i \gets {E_k}^{-1}(c_i) \oplus c_{i-1}$$

return $$m_1m_2…m_l$$

A transmission bit error in block $$c_i$$ affects the decryption of the blocks $$c_i$$ and $$c_{i+1}$$. The block recovered from $$c_i$$ will appear random (here we assume that even a small change in the input of a block cipher will produce a random looking output), while the plaintext recovered from $$c_{i+1}$$ has bit errors precisely where $$c_i$$ did. The block $$c_{i+2}$$ is decrypted correctly. The cipher block chaining mode is self synchronizing, even if one or more entire blocks are lost. A lost ciphertext block results in the loss of the corresponding plaintext block and errors in the next plaintext block.

In both the electronic codebook mode and cipher block chaining mode, $${E_k}^{-1}$$ is applied for decryption. Hence, both modes are also applicable with public key encryption methods, where the computation of $${E_k}^{-1}$$ requires the recipient’s secret, while $$E_k$$ can be easily computed by everyone.

[ This is a part of a series of post on Modes Of Encryption. I had to scribe a lecture as a requirement of a course on the Foundations Of Cryptology at the Indian Institute Of Technology. The scribe has been broken into smaller chunks so that it is easily readable. ]

Popularity: 2% [?]

Electronic Code Book

[ Sometimes the LATEX does not render properly. Just refresh the page and it should do. ]

The simplest of all the encryption modes is the electronic codebook mode. The message is divided into blocks and each block is encrypted separately.

ECB Encryption

ECB Encryption

ECB Decryption

ECB Decryption

ECB is as secure as the underlying block cipher. However, plaintext patterns are not concealed. Each identical block of plaintext gives an identical block of ciphertext. The plaintext can be easily manipulated by removing, repeating or interchanging blocks. As the encryption is deterministic, it is not CPA secure.

The speed of each encryption is identical to that of the block cipher. ECB allows easy parallelization to yield higher performance. Unfortunately, no processing is possible before a block is seen.

In this mode we have $$r = n$$. The ECB is implemented by the following algorithm

Algorithm:

bitStream ecbEncrypt(bitStream m)

divide $$m$$ into $$m_1m_2…m_l$$

for $$i$$ $$\gets$$ $$1$$ to $$l$$ do

$$c_i = E_k(m_i)$$

return $$c_1c_2…c_l$$

For decryption the same algorithm can be used with the decryption function $${E_k}^{-1}$$ instead of $$E_k$$.

If we encrypt many blocks, partial information about the plain text is revealed. Therefor other modes are preferable.

[ This is a part of a series of post on Modes Of Encryption. I had to scribe a lecture as a requirement of a course on the Foundations Of Cryptology at the Indian Institute Of Technology. The scribe has been broken into smaller chunks so that it is easily readable. ]

Popularity: 1% [?]

Modes Of Encryption

[ Sometimes the LATEX does not render properly. Just refresh the page and it should do. ]

Often the length of message exceeds the block length. So, the block ciphers need some extension. Consider a block cipher of length $$n$$. We fix a key $$k$$, and denote the encryption function with this key as $$!E_k\colon \{0, 1\}^n \to \{0, 1\}^n$$
To encrypt a message $$m$$ that is longer than $$n$$, the message is decomposed into blocks of fixed size $$ r, m = m_1m_2…m_l$$. The individual blocks are encrypted iteratively.

The message block size $$r$$ need not equal $$n$$. In few modes of encryption, $$r$$ is smaller than $$n$$.

Also if the length of message $$m$$ is not an integral multiple of $$r$$, then we have to complete the last block. The last block of the message can be padded out with some bits and encrypted. After decryption, the receiver must remove the padding. Therefore he must know how many bits were padded. This can be achieved, for exmple, by storing the number of padded bits in the last byte of the last block.

[ This is a part of a series of post on Modes Of Encryption. I had to scribe a lecture as a requirement of a course on the Foundations Of Cryptology at the Indian Institute Of Technology. The scribe has been broken into smaller chunks so that it is easily readable. ]

Popularity: 1% [?]

BTP On Schedule

Anu

Anu

My BTP is taking up shape now. For a while I have been coding and it was just yesterday that I managed to log some sensible output. A lot of work has yet to be done. But that should not take much time, what with the foundaiton laid and tested. A few more night outs and I shall be up wih good results. The theory part is yet to be touched upon though. A proof has to be done and I have to come up with some sort of a mathematical bound on the under allocation of tasks. This is the tricky part.

Apart from the BTP work, tonight I also have to finish up my scribe and mail it to the professor. I have to scribe a lecture of Cryptography. That’s going to be a hard work, and the highlight for the night. I am dreading having to do a night out and then attend two classes tomorrow starting at 0730 hrs. Hope I don’t sleep midway during the class.

Better get working now. :(

Popularity: 1% [?]

Liverpool Humbles Manchester United

Ferguson vs. Benitez

A win was needed to save the hopes of a title chase for the Reds, and a win they got after 90 minutes of entertaining play. Torres and Gerrard ensured that Liverpool not only beat Manu, but do so convincingly. A 4-0 win against Real Madrid backed up with another 4-1 victory at Old Trafford speaks a lot about the renewed Liverpool.

The match began just like any other one, with Manu pressing forward and looking aggressive. They were the ones to win the first corner of the game. Quater of an hour later, a Ronaldo penalty kick saw them take the lead at the Theater of Dreams. And if the records were to be consulted, you would learn that Manu has never lost at Old Trafford when Ronaldo has scored.

However, a crucial judgemental error by Vidic saw a composed Torres equalise the score. It was a calm and composed striker making sure the ball finds the net. A few minutes left to the half time and Evra fouled Gerrard inside the penalty area. A clean strike and Liverpool were up, a repeat of their performance when they staged Manu at Anfield and won the match 2-1 conceding first.

Gerrard Penalty Shot

Gerrard Penalty Shot

The match was far from over. Manu showed urgency coming into the second half, pushing Liverpool onto defensive. Ferguson altered the 4-4-2 formation into a 4-3-3 by making three substitutions. Drama took place just moments later when Vidic fouled Gerrard and was shown red card by the referee. A perfect free kick and Liverpool were in the driving seat. With the scoreline 3-1 in Liverpool’s favour, Benitez substituted the-not-100-percent-fit Torres. Defending anxiously each wave of Manu’s attack, Liverpool managed to break free once again and score a fourth goal.

Well, Liverpool got what it needed, a victory against Manu at this crucial time. They have now been the better team at both the occasions, winning 2-1 at home and 4-1 away. With newly discovered form and spirit, they do pose a considerable threat to whoever they are drawn against in the Champions League.

Popularity: 1% [?]

Happy Pi Day

Pi Day

Pi Day

For all the math geeks it was a special day yesterday. The last week it was voted to officially recognise 14th of March as the Pi day.

Pi is a mathematical constant, an irrational number which is approximated to 3.14. Thus the 14th day of the 3rd month, which is March the 14th, has been chosen to celebrate the Pi day. Truncating the value of Pi to the 7th digit gives us 3.1415926, which makes 14th of March, 01:59:26 pm.

Apparently, since Pi can also be approximated by the fraction 22/7, people call 22nd of July as the Pi Approximation Day.

Two interesting trivia I found about:

  • 14th of March happens to be Albert Einstein’s birthday. He was born in the year 1879.
  • Massachusetts Institute of Technology often mails out its acceptance letters to be delivered to its prospective students on the Pi Day.

Popularity: 1% [?]

The BrawnGP Stint

BrawnGP

BrawnGP

The recently concluded testing at Barcelona sent shockwaves throughout the F1 paddock regading the high competitiveness of the BrawnGP challenger. With the least amount of testing done, they have already managed to top the speed charts. And not only that, they have managed to put in those quick times quite consistently. This begs a question – Are the BrawnGP really this quick ?

Not a lot should be read into the testing times. A lot of factors come into play, not uncommon among which is the sandbagging that the teams use to not reveal their actual performance pace. This allows them to have an element of surprise going into the first race. Also the fuel loads are not the same for everyone during the testing. Some run longer testing durability and reliability for a race condition, few others test short burst to see if the pace is upto the mark or not and also few, like McLaren says, do not use the complete package that will be used in the race.

However, what BrawnGP has managed to do has amazed even Massa himself, who admitted that Ferrari cannot match the pace of the BrawnGP. Ferrari have been quick, and prior to the Barcelona test they were the ones featuring on the top of the charts. But recent events has thrown things into disarray. McLaren seems to be suffering performance issues. Renault are once again finding themselves lower than what they would have liked to be. Ferrari though quick are not as quick as the BrawnGP.

F60

F60

Also quite a lot can change in a few days once again. Ferrari, BMW and four others have concluded their testing season, but McLaren has another 3 days of testing at Jerez this weekend. Things could turn out in their favour still, with Ron Dennis telling everybody that the aerodynamic package to be used for the Melbourne GP was not used upto now, and will be tested this weekend. If this is indeed true, then they have taken a gamble allowing themselves just 3 days to test their final aerodynamic package.

An interesting rumours that I read regarding the BrawnGP was that they could be running illegal car to top the time sheets and get some sponsorship. With Honda having pulled the plug on its team and Ross Brawn buying out the team, they will be looking for sponsors now. A good performance during the testing season can ensure them just that. I am not trying to accuse Brawn, but its just that he’s a shrewd businessman. If this is not the case, then they have simply managed to produce something magnificient and remarkable into this years championship, and will definitely be one of the main contenders.It could happen that Rubens and Jenson end up chasing each other for the first place in Melbourne, provided the car lasts the distance.

The time is almost up. Within a fortnight it will all be clear who is what. We shall discover the real reason behind BrawnGP pretty soon.

Popularity: 1% [?]