Monday, January 2, 2012

Kerckhoff's Principle

No comments:
Kerckhoff's Principle states that, for an attacker the inner-workings of the cryptosystem should be known completely. The only thing secret will be the key. 


That is the algorithm used for creating the cryptosystem should not be secret. Experience shows that secret algorithms are weak when exposed. (secret things never remain secret...!)

Basic Terms in Information Security

No comments:

Please Note: To explain some terms I am using examples based on Online Banking


Confidentiality - aims to prevent unauthorized reading of the information. For example a customer of an online bank doesn't want some others (customers or intruders) to know his account balance. If the bank failed to protect confidentiality of such informations, it will face legal problems.


Integrity - Information has integrity if unauthorized writing is prohibitted. For e.g. a customer must not be able to improperly change his account balance.


Availability - Data must be available in a timely manner when needed. The attack which tries to reduce access to informations is known as denial of service (DOS) attacks. For e.g. If a customer is not able o do his transaction, the customer might then take his business elsewhere, i.e. he might change the bank for his business.


Cryptology - The art and science of making and breaking "secret codes".


Cryptography - is the making of secret codes.


Crytanalysis - is the breaking of secret codes.


Crypto - synonym for any or all of the following: cryptology, cryptography and cryptanalysis.


Cipher (Cryptosystem) - system used to encrypt the plaintext.


Ciphertext - The result of encryption. We decrypt ciphertext to recover plaintext.


Key - A key is used to configure a cryptosystem.


Symmetric Key - A symmetric key cryptosystem uses the same key to encrypt and to decrypt.


Public Key - A public key cryptosystem uses a public key to encrypt and private key to decrypt.

Monday, November 28, 2011

Search Engine Optimization

No comments:

This post dictates the basic steps involved in SEO which will make easier for the search engines to crawl, index and understant your content. Some small modifications on the parts of your website will rank your pages better in the search engines. The steps are given below:


Step 1:
Give unique and accurate titles for your pages. Page titles are an important aspect of SEO. Title of a page is usally given in the title tag as shown below


<html>
<head>
<title> Flipkart</title>
</head>
..
..


Title tag not only tells the user about the topic of the page. It also tells search engines what the topic of a particular page is. Ideally you are required to create unique title for each pages on your site.


Page titke contents are displayed in the search results, which will help the users to recognize if the page is relevant to their search.


Note:

  • Avoid choosing a title that has no relation to the content on the page.
  • Avoid using default titles like "Untitled Page" or "New Page 1" etc..
  • Avoid using using a single title for all pages of your website.
  • Avoid using lengthy titles





Step 2:
Use description meta tag as shown below.


<html>
<head>
<title>Flipkart</title>
<meta name="description" content="Place your description of the site here">
</head>
..
..


Description mata tags will provide both search engines and users with a summary of what your page is about.


Note:

  • Avoid writing a description meta tag that has no relation to the content on the page.
  • Avoid using general descriptions and single desription to all pages.
  • Do copy-paste the entire contents of your page in the description.
  • Write description in full sentence. Avoid descriptions with only keywords.





Step 3: 
Use simple URLs which will convey the content information easily. Visitors may feel uncomfortable with extremely long and cryptic URLs. 


Avoid using the URLs below
http://www.domainname.com/folder/filename.html
Give proper name to your file and folder which reveals the content of your page. Remember that the URL of a deocument is displayed as part of a search result in Google and other other search engines.


Note:

  • Use words in the URLs rather than ID numbers etc..
  • Avoid using lengthy URLs
  • Avoid using the filenames like "page1.html", "newpage.html", "file1.html" etc
  • Use directory name that have relation to the content of the page
  • Avoid using odd capitalization of URLs
  • Provide only one version of a URL to reach a page. That is avoid using multiple URLs which points to the same page.



Step 4:
Headlines, emphasized words, and lists. Both people and search engines know that anything called out in headlines or subheadings, in boldface or italics, or in bulleted lists is likely to be important. Make sure headings, links, and lists in your Web copy are called out with HTML tags.




Step 5:
Use text links for the navigation. It makes easier for the search engines to crawl and understant your site. Using navigations based on drop-down menus, images or animations will not help seach engines to discover links on your site. Normal Text links will improve the accessibility of your site.


For the above purpose the best practice is to put a HTML site-map page on your site. But when you use such page always check if there is any presence of broken links. 


Step 6:
Make use of 404 page. The 404 or Not Found error message is a HTTP standard response code indicating that the client was able to communicate with the server, but the server could not find what was requested. Users will come to a page that doesn't exist in your site. Having a custom 404 page will guide the users back to the working page of your site.


Note:

  • Avoid allowing your 404 pages to be indexed in the search engines. 
  • Design your 404 page that is consistent with the rest of your site.



Step 7:

  • Improve the content and services on your site. 
  • Interesting sites will increase the recognition on their own. 
  • Users enjoy the content that is simple and easy to follow.
  • Stay organized on the topic. 
  • Create unique content.





Step 8:
When you insert an image provide the image related information by using the "alt" attribute. ie <img src="file.jpg" alt="Describe your image" />


Uses of alt attribute:

  • When a user is viewing your site on a browser that doesn't support images, then the contents of the "alt" will provide the information about the site.
  • The alt text also is treated as an anchor text of a text link. Also it makes the image search of search engines easier to understand the images.
  • Store image files in a directory called images. 





Step 9:
Restrict crawling where it's not needed. 


"robots.txt" file tells search engines whether they can access and therefore crawl parts of your site. This file is placed in the root directory of your site. 
Sample of robots.txt file

User-agent: *
Disallow: /cgi-bin/
Disallow: /tmp/
Disallow: /~joe/

The "User-agent: *" means this section applies to all robots. 
The "Disallow: " tells the robot that it should not visit any of the three directories specified.


Other ways to prevent crawling : adding "NOINDEX" meta tags, using .htaccess to password protect directories.

<html>
<head>
<title>...</title>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
</head>


References-



Monday, November 21, 2011

CONCAT in MySQL

No comments:
CONCAT function returns the string that results from concatenating the arguments.


Example 1:
SELECT CONCAT(column1,column2) from table;
The output for the above will be
Mohanlal
SureshGopi


In between the two columns if you want space or comma, rewrite the query as below


SELECT CONCAT(column1,',',column2) from table;
The output for the above will be
Mohan,lal
Suresh,Gopi


We can also update the table using CONCAT function.


Example 2:
UPDATE table SET column1=CONCAT(column1,column2)


Example 3:
UPDATE table SET column1=CONCAT(column1,'some string')


Example 4: using PHP
mysql_query("UPDATE table SET column1=CONCAT(column1,' ".$variable." ')");