Monday, October 12, 2009

server

import java.rmi.Remote;
import java.rmi.RemoteException;


public interface inter extends Remote
{
double operate(double a, double b, int choice) throws RemoteException;
}

















import java.rmi.*;
import java.rmi.registry.*;
import java.rmi.server.*;
import java.rmi.server.UnicastRemoteObject;
import java.net.*;


public class server extends UnicastRemoteObject implements inter
{
public static Registry registry;


public double operate(double a, double b, int choice)
{

System.out.println("The first number : " + a);
System.out.println("The first number : " + b);

if(choice == 1)
{ System.out.println((a + b)); return (a + b); }
else if(choice == 2)
{ System.out.println((a - b)); return (a - b); }
else if(choice == 3)
{ System.out.println((a * b)); return (a * b); }
else
{ System.out.println((a / b)); return (a / b); }
}

server() throws RemoteException
{}

static public void main(String[] par)
{
try
{
server s = new server();
registry = LocateRegistry.createRegistry(3333);
registry.rebind("serverop", s);
}

catch(RemoteException e)
{
System.out.println(e);
System.exit(1);
}

}

}

client

import java.rmi.*;
import java.rmi.registry.*;
import java.net.*;

import java.util.Scanner;


public class client
{
public static Scanner in = new Scanner(System.in);
public static inter server;
public static Registry registry;

public static double a,
b;
public static String choice;
public static String cont;



static public void main(String[] par)
{

try
{
registry = LocateRegistry.getRegistry("localhost", 3333);
//registry = LocateRegistry.getRegistry(serverAddress, (new Integer(serverPort)).intValue());

server = (inter)(registry.lookup("serverop"));


do
{
do
{
System.out.println("\n\tPlease select operation.");
System.out.println("\t 1. Addition.");
System.out.println("\t 2. Subtraction.");
System.out.println("\t 3. Multiplication.");
System.out.println("\t 4. Division.");

System.out.print("\tYour choice : "); choice = in.nextLine();

if(!((choice.equals("1"))||(choice.equals("2"))||(choice.equals("3"))||(choice.equals("4"))))
{ System.out.println("You have entered an invalid choice."); }

}while(!((choice.equals("1"))||(choice.equals("2"))||(choice.equals("3"))||(choice.equals("4"))));




System.out.print("\tYour first number : "); a = Double.parseDouble(in.nextLine());
System.out.print("\tYour second number : "); b = Double.parseDouble(in.nextLine());

System.out.println("The result : " + server.operate(a, b, Integer.parseInt(choice)));
System.out.println("Do you want to continue [Y / N] : "); cont = in.nextLine();




}while(cont.equals("Y")||cont.equals("y"));
}

catch(RemoteException e)
{
e.printStackTrace();
}
catch(NotBoundException e)
{
e.printStackTrace();
}


}
}

Tuesday, August 18, 2009

My PSM 1 Report - Chapter 3 (Incomplete)

Please click here to view the chapter 3 of my report (Incomplete).

Only the highlighted part is incomplete.

My PSM 1 Report - Gantt Chart (Incomplete)

Please click here to view the Gantt Chart (Incomplete).

My PSM 1 Report - Chapter 2

Please click here to view the chapter 2 of my report.

Saturday, August 1, 2009

My PSM 1 Report - Abstract Writing (Incomplete)

Please click here to view the Abstract Writing (Incomplete).

My PSM 1 Report - Modern Cryptography

Please click here to view the Modern Cryptography report

Monday, July 20, 2009

My PSM 1 Report - Chapter 1

Please click here to view the chapter 1 of my report

Sunday, July 19, 2009

A Little Bit More About AES.

Further study on the candidates that I have chosen. I found out that AES has the most prominent background among the other fours.

AES is an encryption algorithm that was developed and approved by the US government to replace the outdated DES. It is invented by two Belgian cryptographers Joan Daemen and Vincent Rijmen.

Besides these, Java has implemented the AES encryption algorithm in their technology.

Candidates For The Encryption Algorithm

After browsing so many web pages that posted by both professional and unprofessional cryptographers. I finally found out that there are few terms that appeared in most occasions, they are the followings

  • AES (Advanced Encryption Standard)
  • DES (Data Encryption Standard)
  • IDEA (International Data Encryption Algorithm)
  • Blowfish
  • RC 5 (Rivest's Cipher or Ron's Code 5)

If these encryption systems are the most popular, the safest and the most stable. Then, I would like to use one of these encryption systems as my default encryption algorithm in my program.

My Time Table

Please click here to view my time table

Tuesday, July 7, 2009

Very First

This is my first post in blogging