Thursday, 25 April 2013

cookie


<html>
<head>
<script type="text/javascript">
function add_cookies()
{
var name=document.f1.t1.value;
dt= new Date();
var mts=dt.getDate(dt) + 1;
dt.setDate(mts);
document.write(dt);
document.cookie="name" + "=" + name + ";expires="+dt.toUTCString();
}
</script>
</head>
<body>
<form name=f1 method=post action=''>
<input type=text name=t1><input type=button onclick='add_cookies()'; value='Add Cookies'>
</form>
<br><br>
<a href=add-cookies.htm>Add Cookies</a> | <a href=read-cookies.htm>Read Cookies</a>
</body>
</html>

food menu


Foodmenu.xml
<?xml version="1.0"?>
<breakfast_menu>
<food>
<name>Belgian Waffles</name>
<price>$5.95</price>
<description>
two of our famous Belgian Waffles with plenty of real maple syrup
</description>
<calories>650</calories>
</food>
<food>
<name>Strawberry Belgian Waffles</name>
<price>$7.95</price>
<description>
light Belgian waffles covered with strawberries and whipped cream
</description>
<calories>900</calories>
</food>
<food>
<name>Berry-Berry Belgian Waffles</name>
<price>$8.95</price>
<description>
light Belgian waffles covered with an assortment of fresh berries and whipped cream
</description>
<calories>900</calories>
</food>
<food>
<name>French Toast</name>
<price>$4.50</price>
<description>
thick slices made from our homemade sourdough bread
</description>
<calories>600</calories>
</food>
<food>
<name>Homestyle Breakfast</name>
<price>$6.95</price>
<description>
two eggs, bacon or sausage, toast, and our ever-popular hash browns
</description>
<calories>950</calories>
</food>
</breakfast_menu>

catlog


Catalog.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/css" href="exp8_b.css"?>
<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>
<CD>
<TITLE>Hide your heart</TITLE>
<ARTIST>Bonnie Tyler</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>CBS Records</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1988</YEAR>
</CD>
<CD>
<TITLE>Greatest Hits</TITLE>
<ARTIST>Dolly Parton</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>RCA</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1982</YEAR>
</CD>
<CD>
<TITLE>Still got the blues</TITLE>
<ARTIST>Gary Moore</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Virgin records</COMPANY>
<PRICE>10.20</PRICE>
<YEAR>1990</YEAR>
</CD>
<CD>
<TITLE>Eros</TITLE>
<ARTIST>Eros Ramazzotti</ARTIST>
<COUNTRY>EU</COUNTRY>
<COMPANY>BMG</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1997</YEAR>
</CD>
<CD>
<TITLE>One night only</TITLE>
<ARTIST>Bee Gees</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Polydor</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1998</YEAR>
</CD>
<CD>
<TITLE>Sylvias Mother</TITLE>
<ARTIST>Dr.Hook</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>CBS</COMPANY>
<PRICE>8.10</PRICE>
<YEAR>1973</YEAR>
</CD>
<CD>
<TITLE>Maggie May</TITLE>
<ARTIST>Rod Stewart</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Pickwick</COMPANY>
<PRICE>8.50</PRICE>
<YEAR>1990</YEAR>
</CD>
<CD>
<TITLE>Romanza</TITLE>
<ARTIST>Andrea Bocelli</ARTIST>
<COUNTRY>EU</COUNTRY>
<COMPANY>Polydor</COMPANY>
<PRICE>10.80</PRICE>
<YEAR>1996</YEAR>
</CD>
<CD>
<TITLE>When a man loves a woman</TITLE>
<ARTIST>Percy Sledge</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Atlantic</COMPANY>
<PRICE>8.70</PRICE>
<YEAR>1987</YEAR>
</CD>
<CD>
<TITLE>Black angel</TITLE>
<ARTIST>Savage Rose</ARTIST>
<COUNTRY>EU</COUNTRY>
<COMPANY>Mega</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1995</YEAR>
</CD>
<CD>
<TITLE>1999 Grammy Nominees</TITLE>
<ARTIST>Many</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Grammy</COMPANY>
<PRICE>10.20</PRICE>
<YEAR>1999</YEAR>
</CD>
<CD>
<TITLE>For the good times</TITLE>
<ARTIST>Kenny Rogers</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Mucik Master</COMPANY>
<PRICE>8.70</PRICE>
<YEAR>1995</YEAR>
</CD>
<CD>
<TITLE>Big Willie style</TITLE>
<ARTIST>Will Smith</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1997</YEAR>
</CD>
<CD>
<TITLE>Tupelo Honey</TITLE>
<ARTIST>Van Morrison</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Polydor</COMPANY>
<PRICE>8.20</PRICE>
<YEAR>1971</YEAR>
</CD>
<CD>
<TITLE>Soulsville</TITLE>
<ARTIST>Jorn Hoel</ARTIST>
<COUNTRY>Norway</COUNTRY>
<COMPANY>WEA</COMPANY>
<PRICE>7.90</PRICE>
<YEAR>1996</YEAR>
</CD>
<CD>
<TITLE>The very best of</TITLE>
<ARTIST>Cat Stevens</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Island</COMPANY>
<PRICE>8.90</PRICE>
<YEAR>1990</YEAR>
</CD>
<CD>
<TITLE>Stop</TITLE>
<ARTIST>Sam Brown</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>A and M</COMPANY>
<PRICE>8.90</PRICE>
<YEAR>1988</YEAR>
</CD>
<CD>
<TITLE>Bridge of Spies</TITLE>
<ARTIST>T'Pau</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Siren</COMPANY>
<PRICE>7.90</PRICE>
<YEAR>1987</YEAR>
</CD>
<CD>
<TITLE>Private Dancer</TITLE>
<ARTIST>Tina Turner</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Capitol</COMPANY>
<PRICE>8.90</PRICE>
<YEAR>1983</YEAR>
</CD>
<CD>
<TITLE>Midt om natten</TITLE>
<ARTIST>Kim Larsen</ARTIST>
<COUNTRY>EU</COUNTRY>
<COMPANY>Medley</COMPANY>
<PRICE>7.80</PRICE>
<YEAR>1983</YEAR>
</CD>
<CD>
<TITLE>Pavarotti Gala Concert</TITLE>
<ARTIST>Luciano Pavarotti</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>DECCA</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1991</YEAR>
</CD>
<CD>
<TITLE>The dock of the bay</TITLE>
<ARTIST>Otis Redding</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Atlantic</COMPANY>
<PRICE>7.90</PRICE>
<YEAR>1987</YEAR>
</CD>
<CD>
<TITLE>Picture book</TITLE>
<ARTIST>Simply Red</ARTIST>
<COUNTRY>EU</COUNTRY>
<COMPANY>Elektra</COMPANY>
<PRICE>7.20</PRICE>
<YEAR>1985</YEAR>
</CD>
<CD>
<TITLE>Red</TITLE>
<ARTIST>The Communards</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>London</COMPANY>
<PRICE>7.80</PRICE>
<YEAR>1987</YEAR>
</CD>
<CD>
<TITLE>Unchain my heart</TITLE>
<ARTIST>Joe Cocker</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>EMI</COMPANY>
<PRICE>8.20</PRICE>
<YEAR>1987</YEAR>
</CD>
</CATALOG>
Catalog.css
CATALOG
{
background-color: #ffffff;
width: 100%;
}
CD
{
display: block;
margin-bottom: 30pt;
margin-left: 0;
}
TITLE
{
color: #FF0000;
font-size: 20pt;
}
ARTIST
{
color: #0000FF;
font-size: 20pt;
}
COUNTRY,PRICE,YEAR,COMPANY
{
display: block;
color: #000000;
margin-left: 20pt;
}

asp response


Form_response.asp
<html>
<head>
<title>Responding to a form</title>
</head>
<body>
Your name is <% =Request.Form("name") %> <BR>
Your email is <% =Request.Form("email") %>
</body>
</html>
Form_response.html
<html>
<head>
<title>Asking for information</title>
</head>
<body>
<form method="post" action="form_response.asp">
Your name: <input type="text" name="name" size="20"><BR>
Your email: <input type="password" name="email" size="15"><BR>
<input type="Submit" value="Submit">
</form>
</body>
</html>

session


Session.asp
<html>
<body>

<%
response.write("<p>")
response.write("Default Timeout is: " & Session.Timeout & " minutes.")
response.write("</p>")

Session.Timeout=30

response.write("<p>")
response.write("Timeout is now: " & Session.Timeout & " minutes.")
response.write("</p>")
%>

</body>
</html>
Index.asp
<html>
<head>
<title>Responding to a form</title>
</head>
<body>
Your name is <% =Request.Form("name") %> <BR>
Your email is <% =Request.Form("email") %>
</body>
</html>
Page1.asp
<% IF Session("permission")="YES" THEN %>
<html>
<title>Page 1</title>
<body>

Hi <% =Session("username") %>, welcome to Page 1 <BR>
This page is empty at the moment, but it will be very interesting in the next future

</body>
</html>

<% ELSE %>

You are not allowed to access this page

<% end IF %>
Respondtoform.asp
<% IF Request.form="" THEN %>
<html>
<title>Our private pages</title>
<body>
In order to access this pages fill the form below:<BR>
<form method="post" action="index.asp">
Username: <input type="text" name="username" size="20"><BR>
Password: <input type="password" name="password" size="15"><BR>
<input type="Submit" value="Submit">
</form>
</body>
</html>

<% ELSE %>

<%
IF Request.form("username")="Joe" AND Request.form("password")="please" THEN
%>
<%
Session("permission")="YES"
Session("username")="Joe"
%>

<html>
<title>Our private pages</title>
<body>

Hi <% =Session("username") %>, you are allow to see these pages: <BR>
<A HREF="page1.asp">Page 1</A><BR>
<A HREF="page2.asp">Page 2</A>

</body>
</html>

<% ELSE %>

Error in username or password

<% END IF %>

<% END IF %>

form validation


Form validation
<!DOCTYPE html>
<html lang="en"><head>
<meta charset="utf-8">
<title>JavaScript Form Validation using a sample registration form</title>
<meta name="keywords" content="example, JavaScript Form Validation, Sample registration form" />
<meta name="description" content="This document is an example of JavaScript Form Validation using a sample registration form. " />
<link rel='stylesheet' href='js-form-validation.css' type='text/css' />
<script src="sample-registration-form-validation.js"></script>
</head>
<body onLoad="document.registration.userid.focus();">
<h1>Registration Form</h1>
<p>Use tab keys to move from one input field to the next.</p>
<form name='registration' onSubmit="return formValidation();">
<ul>
<li><label for="userid">User id:</label></li>
<li><input type="text" name="userid" size="12" /></li>
<li><label for="passid">Password:</label></li>
<li><input type="password" name="passid" size="12" /></li>
<li><label for="username">Name:</label></li>
<li><input type="text" name="username" size="50" /></li>
<li><label for="address">Address:</label></li>
<li><input type="text" name="address" size="50" /></li>
<li><label for="country">Country:</label></li>
<li><select name="country">
<option selected="" value="Default">(Please select a country)</option>
<option value="AF">Australia</option>
<option value="AL">Canada</option>
<option value="DZ">India</option>
<option value="AS">Russia</option>
<option value="AD">USA</option>
</select></li>
<li><label for="zip">ZIP Code:</label></li>
<li><input type="text" name="zip" /></li>
<li><label for="email">Email:</label></li>
<li><input type="text" name="email" size="50" /></li>
<li><label id="gender">Sex:</label></li>
<li><input type="radio" name="sex" value="Male" /><span>Male</span></li>
<li><input type="radio" name="sex" value="Female" /><span>Female</span></li>
<li><label>Language:</label></li>
<li><input type="checkbox" name="en" value="en" checked /><span>English</span></li>
<li><input type="checkbox" name="nonen" value="noen" /><span>Non English</span></li>
<li><label for="desc">About:</label></li>
<li><textarea name="desc" id="desc"></textarea></li>
<li><input type="submit" name="submit" value="Submit" /></li>
</ul>
</form>
</body>
</html>

Style.css
h1 {
margin-left: 70px;
}
form li {
list-style: none;
margin-bottom: 5px;
}

form ul li label{
float: left;
clear: left;
width: 100px;
text-align: right;
margin-right: 10px;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:14px;
}

form ul li input, select, span {
float: left;
margin-bottom: 10px;
}

form textarea {
float: left;
width: 350px;
height: 150px;
}

[type="submit"] {
clear: left;
margin: 20px 0 0 230px;
font-size:18px
}

p {
margin-left: 70px;
font-weight: bold;
}

splitting names


Splitting name.. javascript
<html>
 <head>
  <title> Experiment No 6(c 1) </title>

<script type="text/javascript">
function SplitName()
{
var myName = prompt("Enter Your complete name: ");
var mySplitName = myName.split(" ");
for(i = 0; i < mySplitName.length; i++)
{
document.write("<br />*** " +mySplitName[i]+"*** having length of "+ mySplitName[i].length + "characters");
}
}
</script>
 </head>

 <body>
  <center>
<h5>Implement a javascript  by using string object enter a complete name ,find out the length of string & 1st name ,last name & middle name</h5>
<form>
<input type="button" value="Split My Name" onclick="SplitName()">
</form>
  </center>
 </body>
</html>

gm ge gn


Print GM a/c to date n time
<html>
 <head>
  <title> Experiment No 6(c 2) </title>
 </head>

 <body>
  <center>
<h5>Implement a javascript  by using date object print GOOD MORNING as per the current date or time.display complete date </h5>

<form>
<input type="button" value="Display" onclick="disp()">

<script type="text/javascript">
function disp()
{
var currentTime = new Date()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
if (minutes < 10)
{
minutes = "0" + minutes
}
document.write("<h4>It is now "+ hours + ":" + minutes + " ")

if(hours > 11)
{
document.write("PM")
}
else
{
document.write("AM")
}
if (minutes <= 59 && hours < 12 )
{
document.write("<h1>Good Marning !!!!!!! </h1>")
}
else if (minutes <= 59 && hours > 12 && hours < 16 )
{
document.write("<h1>Good Afternoon !!!!!!! </h1>")
}
else if (minutes <= 59 && hours > 16 && hours <= 23 )
{
document.write("<h1>Good Evening !!!!!!! </h1>")
}
}
</script>

</form>
  </center>
 </body>
</html>

leap and minor


<html>
<head>

</head>

<body>
<H1 align="center">Check for the Person is He/ She minor? </h1>
<button onclick="minor()">Check for Minor</button>
<button onclick="leap()">Check for Leap year</button>
<script type="text/javascript">
<!--
function minor()
{
var name = prompt("Please enter your name"," ")
var age = prompt("Please enter your age"," ")
if(age < 18 )
alert(name + " is MINOR");
else
alert(name + " is NOT MINOR");
}
function leap()
{
var year = prompt("Please enter year to chech is Leap year or not"," ")
var temp = year % 4

if(temp == 0 )
alert(year + " is LEAP");
else
alert(year + " is NOT LEAP");
}
-->
</script>

</body>
</html>

marks calculator


<html>
<head>

</head>
<body>

<center><h1>Marks Calculation</h1></center>
<script>
<!--
    var n,sum,sub,mark,out,per,tot,res,i,d;
    p=0;
    n=0;
    mark=0;
    out=0;
    tot=0;
    sum=0;
    per=0;
    i=1;

    n=parseInt(prompt("Enter the no. of subject for  you  to see the result:"));
    while(i<=n)
    {
        sub=prompt("enter the subject name:");
        document.write("enter the subject name:");
        document.write(sub);
        mark=parseInt(prompt("enter the marks obtained:"));
        document.write(" marks obtained:");
        document.write(mark);
        out=parseInt(prompt("enter the marks out off:"));
        document.write(" marks out off:");
        document.write(out);
        document.write("&lt;br&gt;");
        i++;
        sum=sum+mark;
        tot=tot+out;
    }
    document.write("TOTAL:");
    document.write(tot);
    document.write("TOTAL MARKS OBTAINED:");
    document.write(sum);
    per=parseFloat(sum/tot*100);
    document.write("PERCENTAGE OBTAINED:");
    document.write(per);

-->
</script>
</body>
</html>

calculator


<html>
<head>
<title>Simple Javascript Calculator - Basic Arithmetic Operations</title>
<script language="javascript" type="text/javascript">
function multiply(){
a=Number(document.calculator.number1.value);
b=Number(document.calculator.number2.value);
c=a*b;
document.calculator.total.value=c;
}
</script>

<script language="javascript" type="text/javascript">
function addition(){
a=Number(document.calculator.number1.value);
b=Number(document.calculator.number2.value);
c=a+b;
document.calculator.total.value=c;
}
</script>

<script language="javascript" type="text/javascript">
function power(){
a=Number(document.calculator.number1.value);
b=Number(document.calculator.number2.value);
c=Math.pow(a, b);
document.calculator.total.value=c;
}
</script>

<script language="javascript"type="text/javascript">
function Sqrt()
{
a=Number(document.calculator.number1.value);
c=Math.sqrt(a);
document.calculator.total.value=c;
}
</script>

<script language="javascript" type="text/javascript">
function subtraction(){
a=Number(document.calculator.number1.value);
b=Number(document.calculator.number2.value);
c=a-b;
document.calculator.total.value=c;
}
</script>

<script language="javascript" type="text/javascript">
function division(){
a=Number(document.calculator.number1.value);
b=Number(document.calculator.number2.value);
c=a/b;
document.calculator.total.value=c;
}
</script>

<script language="javascript" type="text/javascript">
function modulus(){
a=Number(document.calculator.number1.value);
b=Number(document.calculator.number2.value);
c=a%b;
document.calculator.total.value=c;
}
</script>

</head>

<body>

<!-- Opening a HTML Form. -->
<form name="calculator">

<!-- Here user will enter 1st number. -->
Number 1: <input type="text" name="number1">

<!-- Here user will enter 2nd number. -->
Number 2: <input type="text" name="number2">

<!-- Here result will be displayed. -->
Get Result: <input type="text" name="total">

<!-- Here respective button when clicked, calls only respective artimetic function. -->
<input type="button" value="ADD" onclick="javascript:addition();">
<input type="button" value="SUB" onclick="javascript:subtraction();">
<input type="button" value="MUL" onclick="javascript:multiply();">
<input type="button" value="DIV" onclick="javascript:division();">
<input type="button" value="MOD" onclick="javascript:modulus();">
<input type="button" value="POW" onclick="javascript:power();">
<input type="button" value="Sqrt" onclick="javascript:Sqrt();">
</form>

</body>
</html>

inline css


<html>

<body>
<h4>Introduction</h4>
<p class="capitalise">Electromagnetic radiation (EM radiation or EMR) is a form of energy emitted and absorbed by charged particles which exhibits wave-like behavior as it travels through space. EMR has both electric and magnetic field components, which stand in a fixed ratio of intensity to each other, and which oscillate in phase perpendicular to each other and perpendicular to the direction of energy and wave propagation. In a vacuum, electromagnetic radiation propagates at a characteristic speed, the speed of light.
</p>
<h4>History</h4>
<p style="background-image:url('Koala.jpg');

    background-repeat:no-repeat;

    background-position:bottom;

    margin-bottom:1000px;

     font-family:Arial;
     font-size:40px;">

Electromagnetic radiation is a particular form of the more general electromagnetic field (EM field), which is produced by moving charges. Electromagnetic radiation is associated with EM fields that are far enough away from the moving charges that produced them that absorption of the EM radiation no longer affects the behavior of these moving charges. These two types or behaviors of EM field are sometimes referred to as the near and far field. In this language, EMR is merely another name for the far-field. Charges and currents directly produce the near-field. However, charges and currents produce EMR only indirectly—rather, in EMR, both the magnetic and electric fields are associated with changes in the other type of field, not directly by charges and currents. This close relationship assures that the electric and magnetic fields in EMR exist in a constant ratio of strengths to each other, and also to be found in phase, with maxima and nodes in each found at the same places in space.
</p>
</body>




</html>        

external css


<html>
<head>
<link rel=stylesheet type=text/css href="p.css">
</head>
<body>
<h1>INTRODUCTION</h1>
<p>
The Universe is commonly defined as the totality of existence,[1][2][3][4] including planets, stars, galaxies, the contents of intergalactic space, and all matter and energy.[5][6] Definitions and usage vary[how?] and similar terms include the cosmos, the world and nature.

Scientific observation of the Universe, the observable part of which is about 93 billion light years in diameter,[7] has led to inferences of its earlier stages. These observations suggest that the Universe has been governed by the same physical laws and constants throughout most of its extent and history. The Big Bang theory is the prevailing cosmological model that describes the early development of the Universe, which in physical cosmology is believed to have occurred about 13.77 billion years ago.[8]

There are various multiverse hypotheses, in which physicists have suggested that the Universe might be one among many universes that likewise exist.[9][10] The farthest distance that it is theoretically possible for humans to see is described as the observable Universe. Observations have shown that the Universe appears to be expanding at an accelerating rate, and a number of models have arisen to predict its ultimate fate.

</p>
<h2>HISTORY</h2>
<p>Throughout recorded history, several cosmologies and cosmogonies have been proposed to account for observations of the Universe. The earliest quantitative geocentric models were developed by the ancient Greek philosophers. Over the centuries, more precise observations and improved theories of gravity led to Copernicus's heliocentric model and the Newtonian model of the Solar System, respectively. Further improvements in astronomy led to the realization that the Solar System is embedded in a galaxy composed of billions of stars, the Milky Way, and that other galaxies exist outside it, as far as astronomical instruments can reach. Careful studies of the distribution of these galaxies and their spectral lines have led to much of modern cosmology. Discovery of the red shift and cosmic microwave background radiation suggested that the Universe is expanding and had a beginning </p>
</body>
</html>


external.css

body{
              background-image:url('u.jpg') ;
              background-repeat:repeat;
               background-position: center;
              font-family:Times New Roman ;
              font-size:30px;
           }
p{
     text-align:center;
     color:white;
     text-indent:30px ;
  }
h1{
       text-align:center;
       color:REd;
       font-family:Times New Roman;
      }
h2{
       text-align:center;
       color:green;
       font-family:Times New Roman;
      }

frameset


framec.html

<html>
<head>
<title>frames</title>
</head>
<body bgcolor=" #FFEBEB">

</body>
</html>

-------------------------------------

frameset.html

<html>
<head>
<title>Frames</title>
</head>
<frameset rows="15%,*"">
  <frame src="frame_a.html" name=""f1">

<frameset cols="25%,75%">
  <frame src="frame_b.html" name="f2">
  <frame src="frame_c.html" name="f3">
</frameset>
</frameset>
</html>

----------------------
frameb.html

<html>
<head>
<title>frames</title>
</head>
<body bgcolor=" #00FFFF">
<center>
<h2>Practicals Programs List<h2>
</center>
<a href="SEIT_timetable.html" target="f3">1.Time Table</a> <br>
<a href="resume.html" target="f3">2. Resume</a> <br>
<a href="form1.html" target="f3">3. Addmision</a> <br>
<a href="frameset.html" target="f3">4. Frameset</a> <br>
</body>
</html>
--------------------

framea.html

<html>
<head>
<title>frames</title>
</head>
<body bgcolor=" #FFCC66">
<center>
<h1>Internet Programing<h1>
<h2>Practicals<h2>
</center>
</body>
</html>

registration form



<html>
<head><META http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div>
<center><img src="C:\Users\DINKAR\Desktop\Form\mgm.jpg" height="60" width="60"></center>
<center><h1>MGM College Of Engineering & Technology</h1></center></img>
<center><h2><font color="red"> <u> APPLICATION FOR ADDMISSION</u> </font></h2><br>
REV.  <input type="checkbox" name="rev">&nbsp;&nbsp;&nbsp
Mr.   <input type="checkbox" name="mr">&nbsp;&nbsp;&nbsp
Mrs.  <input type="checkbox" name="mrs">&nbsp;&nbsp;&nbsp
Miss  <input type="checkbox" name="miss">&nbsp;&nbsp;&nbsp
Ms.   <input type="checkbox" name="ms"> </center><br>
<pre>
<font face="Times New Roman" size="4">
Surname : <input type="text" name="sname" size="40">        Firstname :   <input type="text" name="fname" size="40">

Date of Birth : DD <input type="text" name="dd" size="2">  MM <input type="text" name="mm" size="2"> YY <input type="text" name="yy" size="4">
<hr noshade color="black" align="center" width="90%" size="4">
<u><b><big> Address for correspondence:</big></b></u>
Street name and number :               <input type="text" name="street" size="110">
   
Suburb :    <input type="text" name="suburb" size="25">                      State :     <input type="text" name="state" size="23">                Post Code :  <input type="text" name="pcode" size="25">

country :    <input type="text" name="country" size="25">                     Email :    <input type="text" name="email" size="82">

Tel.Home : <input type="text" name="home" size="25">                    Buisness : <input type="text" name="state" size="25">               Fax :         <input type="text" name="state" size="25">
<hr noshade color="black" align="center" width="90%" size="4">
<b><u><big>Secondary school studies :-</big></u></b>
<textarea cols="118" rows="8"></textarea>


<big><b><u>Univercity,college, institute, etc.,studies :-</u></b></big>
<textarea cols="118" rows="12"></textarea>


<hr noshade color="black" align="center" width="90%" size="4">

<b><u>Declaration :-</u></b>
I declare that the information submitted above is correct and complete.

Student signature :     <textarea cols="37" rows="2"></textarea> Date : <input type="text" name="date" size="25">



<hr align="center" width="90%" color="black">
</font>
</pre>
</div>
</body></html>

time table


Timetable

<html>
<head>
<title> SEIT Timetable </title>
</head>
<body>
<table border="0" align=center>
<td align=center><img src="mgm_logo.png" alt="MGM logo" height="75" width="75"  align="middle"></td>
</table>
<MARQUEE   height=55 weight="80%" align=middle bgcolor=yellow><font size="10" color="red">MGM CET</font><BR>
          </MARQUEE>

<BR>
<h1 align=middle>SEIT CLASS TIMETABLE </h1>

<table border="1" align=center>
 <tr>
 <th align=center>Day/Time</th>
 <th align=center>&nbsp </th>
 <th align=center>08.30-09.30</th>
<th align=center>09.30-10.30</th>
<th align=center>10.30-11.30</th>
<th align=center>11.30-12.30</th>
<th align=center>12.30-13.00</th>
<th align=center>13.00-14.00</th>
<th align=center>14.00-15.00</th>
<th align=center>15.00-16.00</th>
<th align=center>16.00-17.00</th>
</tr>
 <tr >
 <td rowspan=3 align=center>Monday</td>
 <td align=center>Subject</td>
 <td align=center>FAM(T)</td>
 <td align=center>CM(L)</td>
 <td align=center>NTDD(L)</td>
<td align=center rowspan=3>OL</td>
<td align=center rowspan=16></td>
<td align=center>PCOM(L)</td>
<td align=center>MPMC(L)</td>
<td align=center colspan=2>PCOM/MPMC(P)</td>
</tr>
 <tr>
<td align=center> Faculty</td>
 <td align=center> YJ</td>
 <td align=center> DBP</td>
 <td align=center> DS</td>
<td align=center> NLB</td>
<td align=center>ES</td>
<td COLSPAN=2 align=center> NLB/RS</td>
</tr>
 <tr>
<td align=center> Room/Lab</td>
 <td align=center> 213</td>
 <td align=center> 213</td>
 <td align=center> 213</td>
<td align=center> 213</td>
<td align=center> 213</td>
<td COLSPAN=2 align=center> Lab-1/ Lab-2</td>
</tr>




 <tr >
 <td rowspan=3 align=center>Tuesday</td>
 <td align=center>Subject</td>
 <td align=center>PCOM(L)</td>
 <td align=center>CM(T)</td>
 <td align=center>MPMC(L)</td>
<td align=center >NTDT(L)</td>

<td align=center>FAM(L)</td>
<td align=center ROWSPAN=3>OL</td>
<td align=center colspan=2>MPMC/PCOM(P)</td>
</tr>
 <tr>
<td align=center> Faculty</td>
 <td align=center> YJ</td>
 <td align=center> DBP</td>
 <td align=center> DS</td>
<td align=center> NLB</td>
<td align=center>ES</td>
<td COLSPAN=2 align=center> NLB/RS</td>
</tr>
 <tr>
<td align=center> Room/Lab</td>
 <td align=center> 213</td>
 <td align=center> 213</td>
 <td align=center> 213</td>
<td align=center> 213</td>
<td align=center> 213</td>
<td COLSPAN=2 align=center> Lab-1/ Lab-2</td>
</tr>




<tr >
 <td rowspan=3 align=center>Wednesday</td>
 <td align=center>Subject</td>
 <td align=center>FAM(L)</td>
 <td align=center>MPMC(L)</td>
 <td align=center>NTDT(L)</td>
<td align=center >IP(L)</td>

<td align=center>CM(L)</td>
<td align=center >FAM(T)</td>
<td align=center colspan=2 ROWSPAN=3>OL</td>
</tr>
 <tr>
<td align=center> Faculty</td>
 <td align=center> YJ</td>
 <td align=center> ES</td>
 <td align=center> DS</td>
<td align=center> KM</td>
<td align=center>DBP</td>
<td align=center> YJ</td>
</tr>
 <tr>
<td align=center> Room/Lab</td>
 <td align=center> 213</td>
 <td align=center> 213</td>
 <td align=center> 213</td>
<td align=center> 213</td>
<td align=center> 213</td>
<td align=center> 213</td>
</tr>




<tr >
 <td rowspan=3 align=center>Thursday</td>
 <td align=center>Subject</td>
 <td align=center>PCOM(L)</td>
 <td align=center>CM(L)</td>
 <td align=center>NTDD(L)</td>
<td align=center>FAM(L)</td>
<td align=center COLSPAN=4 >IP/NTDD(P)</td>

</tr>
 <tr>
<td align=center> Faculty</td>
 <td align=center> NLB</td>
 <td align=center> DBP</td>
 <td align=center> DS</td>
<td align=center> YJ</td>
<td align=center COLSPAN=4 > KM/AY</td>

</tr>
 <tr>
<td align=center> Room/Lab</td>
 <td align=center> 213</td>
 <td align=center> 213</td>
 <td align=center> 213</td>
<td align=center> 213</td>
<td align=center COLSPAN=4 > LAB-1/ LAB-2</td>
</tr>


<tr >
 <td rowspan=3 align=center>FRIDAY</td>
 <td align=center>Subject</td>
 <td align=center>PCOM(L)</td>
 <td align=center>CM(L)</td>
 <td align=center>MPMC(L)</td>
<td align=center>IP(L)</td>
<td align=center COLSPAN=4 >NTDD/IP(P)</td>

</tr>
 <tr>
<td align=center> Faculty</td>
 <td align=center> NLB</td>
 <td align=center> DBP</td>
 <td align=center> ES</td>
<td align=center> KM</td>
<td align=center COLSPAN=4 > AY/KM</td>

</tr>
 <tr>
<td align=center> Room/Lab</td>
 <td align=center> 213</td>
 <td align=center> 213</td>
 <td align=center> 213</td>
<td align=center> 213</td>
<td align=center COLSPAN=4 > LAB-1/ LAB-2</td>

</tr>



</table>



</body>
</html>

resume


Resume
<html>
<head>
</head><body>



<div>
<h4>NAME :</h4><br>
<h4>Address :</h4><br>
<hr>
<table bgcolor="#FFC0CB" width="100%" border="1">
<tr>
<td><b>Objective </b></td>
</tr>
</table><br>
To join an organization that will recognize and utilize my skills fully and offer me a position requiring innovative and creative ideas where continuous growth and learning are way of life<br><br>
<table bgcolor="#FFC0CB" width="100%" border="1">
<tr>
<td><b>Academic Record </b></td>
</tr>
</table>
<table width="10%" border="1">
<tr>
<th align="center"><table bgcolor="#FFC0CB" width="100%" border="1">
<tr>
<td><b>Class/Course </b></td>
</tr>
</table></th>
<th align="center"><table bgcolor="#FFC0CB" width="100%" border="1">
<tr>
<td><b>Name of the Institution </b></td>
</tr>
</table></th>
<th align="center"><table bgcolor="#FFC0CB" width="100%" border="1">
<tr>
<td><b>University/Board of Study </b></td>
</tr>
</table></th>
<th align="center"><table bgcolor="#FFC0CB" width="100%" border="1">
<tr>
<td><b>Year of Passing </b></td>
</tr>
</table></th>
</tr>
<tr>
<th align="center"><table bgcolor="#FFC0CB" width="100%" border="1">
<tr>
<td><b>B.E. Mechanical Engineering </b></td>
</tr>
</table></th>
<th align="center"><table width="100%">
<tr>
<td></td>
</tr>
</table></th>
<th align="center"><table width="100%">
<tr>
<td></td>
</tr>
</table></th>
<th align="center"><table width="100%">
<tr>
<td></td>
</tr>
</table></th></tr>
<tr>
<th align="center"><table bgcolor="#FFC0CB" width="100%" border="1">
<tr>
<td><b>H.Sc. </b></td>
</tr>
</table></th>
<th align="center"><table width="100%">
<tr>
<td></td>
</tr>
</table></th>
<th align="center"><table width="100%">
<tr>
<td></td>
</tr>
</table></th>
<th align="center"><table width="100%">
<tr>
<td></td>
</tr>
</table></th></tr>
<tr>
<th align="center"><table bgcolor="#FFC0CB" width="100%" border="1">
<tr>
<td><b>S.S.L.C.</b></td>
</tr>
</table></th>
<th align="center"><table width="100%">
<tr>
<td></td>
</tr>
</table></th>
<th align="center"><table width="100%">
<tr>
<td></td>
</tr>
</table></th>
<th align="center"><table width="100%">
<tr>
<td></td>
</tr>
</table></th></tr>
</table>
<table bgcolor="#FFC0CB" width="100%" border="1">
<tr>
<td><b>Additional Qualification</b></td>
</tr>
</table><br>
<ul type="disc">
<li>Studied AutoCad</li>
</ul>
<table bgcolor="#FFC0CB" width="100%" border="1">
<tr>
<td><b>Key Skills </b></td>
</tr>
</table><br>
<ul type="disc">
<li>Major factor for maintainance of relationship with key people and behaviour</li>
<li>Extremely successful and maintaining relationship with people through regular meeting</li>
</ul>
</div>

</body></html>

Sunday, 21 April 2013

IMPORTANT QUESTIONS FOR NTDD VIVA.





What are the different layers in OSI model ?2.

What are the different layers in TCP/IP model ?3.

Difference between OSI & TCP/IP reference model.4.

What is the advantage of layering ?5.

Difference between packet and circuit switching ?6.

What are the functions of data link layer ?7.

What is ALOHA ?8.

Slotted aloha.9.

Difference between Aloha & Slotted Aloha.10.

CSMA/CD.11.

Bit stuffing.12.

Even parity and odd parity examples.13.

Hamming code examples.14.

What is CRC ?15.

What is flow control ?16.

Explain stop & wait protocol.17.

Sliding window protocol.18.

What is token bus & token ring.19.

Time Division Multiplexing (TDM) & Frequency Division Multiplexing (FDM).20.

What is the maximum size of frame ?21.

What is the maximum size of packet ?22.

What is routing ?23.

What is congestion ?24.

Difference between congestion control & flow control.25.

What is subnet ?26.

What is TCP segment header size.27.

What is three way handshaking.28.

Hub ; Bridge ; Switch (Definition & difference).29.

What is distributed computing.30.

Difference between Distributed & centralized computing.31.

What is the remote procedure call ?32.

Difference between public key & private key.33.

Leaky bucket algorithm.34.

Difference between IPV4 & IPV6.35.

SNMP, OSPF, ARP, RARP, BGP, ICMP, BOOTP

Saturday, 20 April 2013

CORBA


CORBA is a mechanism in software for normalizing the method-call semantics between application objects that reside either in the same address space (application) or remote address space (same host, or remote host on a networkThe CORBA specification dictates that there shall be an ORB through which the application interacts with other objects. In practice, the application simply initializes the ORB, and accesses an internal Object Adapter which maintains such issues as reference counting, object (and reference) instantiation policies, object lifetime policies, etc. The Object Adapter is used to register instances of the generated code classes. Generated code classes are the result of compiling the user IDL code, which translates the high-level interface definition into an OS- and language-specific class base for use by the user application. This step is necessary in order to enforce the CORBA semantics and provide a clean user process for interfacing with the CORBA infrastructure.
Figure 1-2 CORBA  Architecture

Illustration of the autogeneration of the infrastructure code from an interface defined using the CORBA IDLThis figure illustrates the high-level paradigm for remote interprocess communications using CORBA. Issues not addressed here, but that are accounted-for in the CORBA specification include: data typing, exceptions, network protocol, communication timeouts, etc. For example: Normally the server side has the Portable Object Adapter (POA) that redirects calls either to the local servants or (to balance the load) to the other servers. Also, both server and client parts often have interceptors that are described below. Issues CORBA (and thus this figure) does not address, but that all distributed systems must address: object lifetimes, redundancy/fail-over, naming semantics (beyond a simple name), memory management, dynamic load balancing, separation of model between display/data/control semantics, etc.
CORBA defines an architecture for distributed objects. The basic CORBA paradigm is that of a request for services of a distributed object. Everything else defined by the OMG is in terms of this basic paradigm. The services that an object provides are given by its interface. Interfaces are defined in OMG's Interface Definition Language (IDL). Distributed objects are identified by object references, which are typed by IDL interfaces.
The ORB is the distributed service that implements the request to the remote object. It locates the remote object on the network, communicates the request to the object, waits for the results and when available communicates those results back to the client.
The ORB implements location transparency. Exactly the same request mechanism is used by the client and the CORBA object regardless of where the object is located. It might be in the same process with the client, down the hall or across the planet. The client cannot tell the difference.
The ORB implements programming language independence for the request. The client issuing the request can be written in a different programming language from the implementation of the CORBA object. The ORB does the necessary translation between programming languages. Language bindings are defined for all popular programming languages.

CORBAservicesline

OMG is pleased to announce a new format for its formal CORBAservices specifications. Previously, the CORBAservices were combined into one "binder" and you had the option to view/print the complete set of services or each service.
The new format treats each CORBAservice as its own stand-alone document. You have the option to view/print each CORBAservice separately. There are several CORBA services. The popular ones are described in detail in another module of this course. Below is a brief description of each:
Service
Description
Object life cycle
Defines how CORBA objects are created, removed, moved, and copied
Naming
Defines how CORBA objects can have friendly symbolic names
Events
Decouples the communication between distributed objects
Relationships
Provides arbitrary typed n-ary relationships between CORBA objects
Externalization
Coordinates the transformation of CORBA objects to and from external media
Transactions
Coordinates atomic access to CORBA objects
Concurrency Control
Provides a locking service for CORBA objects in order to ensure serializable access
Property
Supports the association of name-value pairs with CORBA objects
Trader
Supports the finding of CORBA objects based on properties describing the service offered by the object
Query
Supports queries on objects

Simple Network Management Protocol



Simple Network Management Protocol (SNMP) is a UDP-based network protocol. It is used mostly in network management systems to monitor network-attached devices for conditions that warrant administrative attention. SNMP is a component of the Internet Protocol Suite as defined by the Internet Engineering Task Force (IETF). It consists of a set of standards for network management, including an application layer protocol, a database schema, and a set of data objects
Control and supervision of modern networks can quickly become a challenging task, especially when handling heterogeneous network topologies. The Interpeak SNMP Agent resolves this by providing a uniform management interface using the industry-standard SNMP protocol.

The SNMP Protocol

Simple Network Management Protocol (SNMP) is one of the standard operations and maintenance protocols for the Internet. SNMP has been a key technology that enabled the Internet's phenomenal growth. This page provides information about this protocol, ranging from beginner's FAQs to the latest industry standard - SNMPv3. 

SNMP

SNMP standards are defined in a series of documents, called request for comments or RFCs, proposed by the Internet Engineering Task Force (IETF). A list of RFCs for SNMPv1, SNMPv2, and SNMPv3 is available. Please note that the IETF has changed the recommended status of SNMPv1 and SNMPv2c to historic. The IETF now recommends using SNMPv3 for internet management.

SNMPv3

SNMPv3 with Security and Administration
Information on SNMP Research's implementations, as well as general SNMPv3 information.

Advanced Protocol Operations
SNMP Research's initiative for product evolution, protocol enhancement, and to align with future industry standards.

Extended Security Options
SNMP Research products beginning with release 16.1 (domestic) support the Triple DES Privacy Protocol and the Advanced Encryption Standard (AES) Privacy Protocol for SNMPv3 privacy.

XML-Based Internet Management
Discover how SNMP Research has been developing solutions to incorporate the Extensible Markup Language (XML) into standards-based network management.

SNMP FAQ

SNMP FAQ (part 1) from comp.protocols.snmp
Beginner to advanced information about SNMP.

SNMP FAQ (part 2) from comp.protocols.snmp
Beginner to advanced information about SNMP.

SNMP Research Activities

The SNMP Research and IETF Activities Web page contains presentations on the Evolution of SNMP (EOS) and on the Status of Internet Management, as well as information about SNMPCONF activities.
Presentations from IM2001 and NANOG 22.

Requests for Comments (RFCs)

List of RFCs from the IETF (Internet Engineering Task Force).

SNMP & Network Web Sites

IETF: The Internet Engineering Task Force posts information on its groups, activities, and current happenings with the status of Internet network management.
Get the IEEE 802™ Program. The IEEE Standards Association and the IEEE 802 Plenary offer the "Get IEEE 802" pilot program, which grants public access to view and download individual electronic (PDF) IEEE Local and Metropolitan Area Network (IEEE 802) standards at no charge.
mibDepot is an online SNMP MIB reference site. A powerful search engine lets you search quickly for any MIB object or SNMP trap. This site includes MIBs from many vendors.
The Simple Times is a quarterly newsletter devoted to the "promotion of the Simple Network Management Protocol. " Each Issue contains technical articles, featured columns, standards, summaries, and a list of Internet resources.
The Simple Web is a Web site created and maintained by the SNMP group at the University of Twente in Holland. This page contains pointers to many sources of information about SNMP and management.
SNMP World is a Web site created and maintained by a group of Network Management Engineers. This page offers information about SNMP and network management.

SNMP Print Literature

Books About SNMP provides a list of books about SNMP technology and enterprise management using SNMP.

SNMP Mailing List

PSINet SNMP mailing list: snmp-request@lists.psi.com.

SNMP Testing Tools

Gambit Communications provides SNMP Agent simulation software.
InterWorking Labs provides a full line of test suite software products.
SimpleSoft provides SNMP agent simulation and automated agent testing software.

Proxy Agent Concepts

Proxy Agent Concepts provides information sheets.

Since its creation in 1988 as a short-term solution to manage elements in the growing Internet and other attached networks, SNMP has achieved widespread acceptance. SNMP was derived from its predecessor SGMP (Simple Gateway Management Protocol) and was intended to be replaced by a solution based on the CMIS/CMIP (Common Management Information Service/Protocol) architecture. This long-term solution, however, never received the widespread acceptance of SNMP.
SNMP is based on the manager/agent model consisting of an SNMP manager, an SNMP agent, a database of management information, managed SNMP devices and the network protocol. The SNMP manager provides the interface between the human network manager and the management system. The SNMP agent provides the interface between the manager and the physical device(s) being managed (see the illustration above).
SNMP is based on the manager/agent model
SNMP is based on the manager/agent model of a network management architecture.
The SNMP manager and agent use an SNMP Management Information Base (MIB) and a relatively small set of commands to exchange information. The SNMP MIB is organized in a tree structure with individual variables, such as point status or description, being represented as leaves on the branches. A long numeric tag or object identifier (OID) is used to distinguish each variable uniquely in the MIB and in SNMP messages.
SNMP uses five basic messages (GET, GET-NEXT, GET-RESPONSE, SET, and TRAP) to communicate between the SNMP manager and the SNMP agent. The GET and GET-NEXT messages allow the manager to request information for a specific variable.
The agent, upon receiving a GET or GET-NEXT message, will issue a GET-RESPONSE message to the SNMP manager with either the information requested or an error indication as to why the request cannot be processed. A SET message allows the SNMP manager to request a change be made to the value of a specific variable in the case of an alarm remote that will operate a relay. The SNMP agent will then respond with a GET-RESPONSE message indicating the change has been made or an error indication as to why the change cannot be made. The SNMP TRAP message allows the agent to spontaneously inform the SNMP manager of an "important" event.
As you can see, most of the messages (GET, GET-NEXT, and SET) are only issued by the SNMP manager. Because the TRAP message is the only message capable of being initiated by an SNMP agent, it is the message used by DPS Remote Telemetry Units (RTUs) to report alarms. This notifies the SNMP manager as soon as an alarm condition occurs, instead of waiting for the SNMP manager to ask.
The small number of commands used is only one of the reasons SNMP is "simple." The other simplifying factor is the SNMP protocol's reliance on an unsupervised or connectionless communication link. This simplicity has led directly to the widespread use of SNMP, specifically in the Internet Network Management Framework. Within this framework, it is considered "robust" because of the independence of the SNMP managers from the agents, e.g. if an SNMP agent fails, the SNMP manager will continue to function, or vice versa. The unsupervised communication link does however create some interesting issues for network alarm monitoring we will discuss more thoroughly in a later issue of our SNMP tutorial.

Each SNMP element manages specific objects with each object having specific characteristics. Each object / characteristic has a unique object identifier (OID) consisting of numbers separated by decimal points (i.e., 1.3.6.1.4.1.2682.1). These object identifiers naturally form a tree as shown below. The MIB associates each OID with a readable label (i.e., dpsRTUAState) and various other parameters related to the object. The MIB then serves as a data dictionary or code book that is used to assemble and interpret SNMP messages.
MIB object identifier tree
The branch of the MIB object identifier tree.
When an SNMP manager wants to know the value of an object / characteristic, such as the state of an alarm point, the system name, or the element uptime, it will assemble a GET packet that includes the OID for each object / characteristic of interest. The element receives the request and looks up each OID in its code book (MIB). If the OID is found (the object is managed by the element), a response packet is assembled and sent with the current value of the object / characteristic included. If the OID is not found, a special error response is sent that identifies the unmanaged object.
When an element sends a TRAP packet, it can include OID and value information (bindings) to clarify the event. DPS remote units send a comprehensive set of bindings with each TRAP to maintain traditional telemetry event visibility. Well-designed SNMP managers can use the bindings to correlate and manage the events. SNMP managers will also generally display the readable labels to facilitate user understanding and decision-making.
SNMP is a standard protocol that has wide acceptance in the industry and is flexible enough to describe almost anything. Because of these advantages, many network managers have come to believe that SNMP should be used for all network monitoring applications.
SNMP certainly has its place in an effective telecom network management solution, but this doesn't mean that any off-the-shelf SNMP manager can provide adequate visibility and control of your network.
The typical off-the-shelf SNMP manager is not designed for displaying and processing telemetry data for effective network monitoring, especially for the kind of real-world monitoring tasks network managers most need performed. These capabilities can be added to an SNMP manager, but it usually requires substantial custom software development.


RSA algorithm




Aim:Write a program to implement RSA algorithm
Theory: Cryptography has a long and colorful history. The message to be encrypted, known as the plaintext, are transformed by a function that is parameterized by a key. The output of the encryption process, known as the ciphertext, is then transmitted, often by messenger or radio. The enemy, or intruder, hears and accurately copies down the complete ciphertext. However, unlike the intended recipient, he does not know the decryption key and so cannot decrypt the ciphertext easily. The art of breaking ciphers is called cryptanalysis the art of devising ciphers (cryptography) and breaking them (cryptanalysis) is collectively known as cryptology.
There are several ways of classifying cryptographic algorithms. They are generally categorized based on the number of keys that are employed for encryption and decryption, and further defined by their application and use. The three types of algorithms are as follows:
1.      Secret Key Cryptography (SKC): Uses a single key for both encryption and decryption. It is also known as symmetric cryptography.
2.      Public Key Cryptography (PKC): Uses one key for encryption and another for decryption. It is also known as asymmetric cryptography.
3.      Hash Functions: Uses a mathematical transformation to irreversibly "encrypt" information

Public-key cryptography has been said to be the most significant new development in cryptography. Modern PKC was first described publicly by Stanford University professor Martin Hellman and graduate student Whitfield Diffie in 1976. Their paper described a two-key crypto system in which two parties could engage in a secure communication over a non-secure communications channel without having to share a secret key.
Generic PKC employs two keys that are mathematically related although knowledge of one key does not allow someone to easily determine the other key. One key is used to encrypt the plaintext and the other key is used to decrypt the ciphertext. The important point here is that it does not matter which key is applied first, but that both keys are required for the process to work. Because pair of keys is required, this approach is also called asymmetric cryptography.
In PKC, one of the keys is designated the public key and may be advertised as widely as the owner wants. The other key is designated the private key and is never revealed to another party. It is straight forward to send messages under this scheme.
The RSA algorithm is named after Ron Rivest, Adi Shamir and Len Adleman, who invented it in 1977. The RSA algorithm can be used for both public key encryption and digital signatures. Its security is based on the difficulty of factoring large integers.

Algorithm :
1.      Generate two large random primes, P and Q, of approximately equal size.
2.      Compute N = P x Q
3.      Compute Z = (P-1) x (Q-1).
4.      Choose an integer E, 1 < E < Z, such that GCD (E, Z) = 1
5.      Compute the secret exponent D, 1 < D < Z, such that E x D ≡ 1 (mod Z)
6.      The public key is (N, E) and the private key is (N, D).

Where, the values of P, Q, and Z should also be kept secret.
The message is encrypted using public key and decrypted using private key.
An example of RSA encryption :
1.      Select primes P=11, Q=3.
2.      N = P x Q = 11 x 3 = 33
Z = (P-1) x (Q-1) = 10 x 2 = 20
3.      Lets choose E=3
Check GCD(E, P-1) = GCD(3, 10) = 1 (i.e. 3 and 10 have no common factors except 1),
and check GCD(E, Q-1) = GCD(3, 2) = 1
therefore GCD(E, Z) = GCD(3, 20) = 1
4.      Compute D such that E x D ≡ 1 (mod Z)
compute D = E^-1 mod Z = 3^-1 mod 20
find a value for D such that Z divides ((E x D)-1)
find D such that 20 divides 3D-1.
Simple testing (D = 1, 2, ...) gives D = 7
Check: (E x D)-1 = 3.7 - 1 = 20, which is divisible by Z.
5.      Public key = (N, E) = (33, 3)
Private key = (N, D) = (33, 7).

Now say we want to encrypt the message m = 7,
Cipher code = M^E mod N
                    = 7^3 mod 33
                    = 343 mod 33
                    = 13.
    Hence the ciphertext c = 13.

To check decryption we compute Message’ = C^D mod N
                                                           = 13^7 mod 33
                                                           = 7.

Here, we don't have to calculate the full value of 13 to the power 7 here. We can make use of the fact that a = bc mod n = (b mod n).(c mod n) mod n so we can break down a potentially large number into its components and combine the results of easier, smaller calculations to calculate the final value.


Conclusion: Hence, we have implemented RSA algorithm.


Program Source Code :

Program to implement RSA Algorithm


import java.io.*;
import java.util.*;
class RSA
{
 public static void main(String args[])
 {
  Scanner ip=new Scanner(System.in);
  int p,q,n,e=1,j;
  int d=1,i1;
  int t1,t2;
  int pt[]= new int[10];
  int ct[]= new int[10];
  int rt[]= new int[10];
  String i=new String();
  System.out.println("Enter the two prime numbers:");
  p=ip.nextInt();
  q=ip.nextInt();
  System.out.println("Enter the message to be sent");
  i=ip.next();
  i1=i.length();
  for(j=0;j<i1;j++)
  {
   pt[j]=(i.charAt(j))-96;
  }
  n=p*q;
  t1=p-1;
  t2=q-1;
  while((t1*t2)%e==0)
  {
   e++;
  }
  for(j=0;j<i1;j++)
  {
   ct[j]=((int)Math.pow(pt[j],e))%n;
  }
  System.out.println("Sender Side:");
  System.out.println("----------------------");
  System.out.println("Public Key(e)= "+e);
  for(j=0;j<i1;j++)
  {
   System.out.println("Cipher Text= "+ct[j]);
  }
  System.out.println("Receiver Side:");
  System.out.println("----------------------");
  while((d*e)%(t1*t2)!=1)
  {
   d++;
  }
  System.out.println("Private Key(d)= "+d);
  for(j=0;j<i1;j++)
  {
   rt[j]=((int)Math.pow(ct[j],d))%n;
   System.out.println("Plain Text= "+rt[j]);
  }
  System.out.print("Decrypted Message:");
  for(j=0;j<i1;j++)
  {
   rt[j]=rt[j]+96;
   System.out.print((char)rt[j]);
  }
 }
}



C:\Program Files\Java\jdk1.6.0_02\bin>javac RSA.java

C:\Program Files\Java\jdk1.6.0_02\bin>java RSA

Enter the two prime numbers:
3
5
Enter the message to be sent
abcdefg
Sender Side:
------------------
Public Key(e)=3
Cipher Text= 1
Cipher Text= 8
Cipher Text= 12
Cipher Text= 4
Cipher Text= 5
Cipher Text= 6
Cipher Text= 13
Receiver Side:
------------------
Private key(d)=3
Plain Text= 1
Plain Text= 2
Plain Text= 3
Plain Text= 4
Plain Text= 5
Plain Text= 6
Plain Text= 7
Decrypted Message:abcdefg
C:\Program Files\Java\jdk1.6.0_02\bin>