Monday 24 November 2014

PlayFair Cipher CryptoSystem using JAVA with Example

PlayFair Cipher CryptoSystem Using JAVA with Example

Introduction:


The Playfair cipher was the first practical digraph substitution cipher. The scheme was invented in 1854 by Charles Wheatstone, but was named after Lord Playfair who promoted the use of the cipher. The technique encrypts pairs of letters (digraphs), instead of single letters as in the simple substitution cipher. The Playfair is significantly harder to break since the frequency analysis used for simple substitution ciphers does not work with it. Frequency analysis can still be undertaken, but on the 25*25=625 possible digraphs rather than the 25 possible monographs. Frequency analysis thus requires much more ciphertext in order to work. For a tutorial on breaking Playfair with a simulated annealing algorithm, see Cryptanalysis of the Playfair Ciphe.
It was used for tactical purposes by British forces in the Second Boer War and in World War I and for the same purpose by the Australians during World War II. This was because Playfair is reasonably fast to use and requires no special equipment. A typical scenario for Playfair use would be to protect important but non-critical secrets during actual combat. By the time the enemy cryptanalysts could break the message the information was useless to them.
From Kahn's 'The CodeBreakers':
Perhaps the most famous cipher of 1943 involved the future president of the U.S., J. F. Kennedy, Jr. On 2 August 1943, Australian Coastwatcher Lieutenant Arthur Reginald Evans of the Royal Australian Naval Volunteer Reserve saw a pinpoint of flame on the dark waters of Blackett Strait from his jungle ridge on Kolombangara Island, one of the Solomons. He did not know that the Japanese destroyer Amagiri had rammed and sliced in half an American patrol boat PT-109, under the command of Lieutenant John F. Kennedy, United States Naval Reserve. Evans received the following message at 0930 on the morning of the 2 of August 1943:

Inventor of PlayFair Cipher CryptoSystem

Handling Mouse Events in Applet using JAVA with Example

Handling Mouse Event in Applet using JAVA with Example

in java there are many events and event handling class and interfaces (ex. MouseEvent, ActionEvent, etc.) for that you have two option to handle it
  1. implementing Interface
  2. extending Adapter class
  • Implementing Interface:- with implementing interface JAVA have many interfaces (ex.MouseLitener, MouseMotionListener, ActionListener etc) with this interfaces you can handle events performed by source control.

    Note: we have consider over here only implementing interface and second one will see in next articl.
  • MouseListenter Interface:this interface is use to handling mouse events like...
public void mouseClicked (MouseEvent me) {}
 public void mouseEntered (MouseEvent me) {}
 public void mousePressed (MouseEvent me) {}
 public void mouseReleased (MouseEvent me) {}
 public void mouseExited (MouseEvent me) {} 
Note: Mouse generates MouseEvent

Friday 14 November 2014

RSA CryptoSystem using JAVA

RSA CryptoSystem Using JAVA

RSA is one of the first practicable public-key cryptosystems and is widely used for secure data transmission. In such a cryptosystem, the encryption key is public and differs from the decryption key which is kept secret. In RSA, this asymmetry is based on the practical difficulty of factoring the product of two large prime numbers, the factoring problem. RSA stands for Ron Rivest, Adi Shamir and Leonard Adleman, who first publicly described the algorithm in 1977. Clifford Cocks, an English mathematician, had developed an equivalent system in 1973, but it wasn't declassified until 1997.
A user of RSA creates and then publishes a public key based on the two large prime numbers, along with an auxiliary value. The prime numbers must be kept secret. Anyone can use the public key to encrypt a message, but with currently published methods, if the public key is large enough, only someone with knowledge of the prime numbers can feasibly decode the message. Breaking RSA encryption is known as the RSA problem. It is an open question whether it is as hard as the factoring problem.



Wednesday 12 November 2014

Depth first search (DFS) with C Language code

Depth first search (DFS) with C Language code

Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. One starts at the root (selecting some arbitrary node as the root in the case of a graph) and explores as far as possible along each branch before backtracking.
A version of depth-first search was investigated in the 19th century by French mathematician Charles Pierre Trémaux as a strategy for solving mazes
 


Breadth first search (BFS) with C language code


Breadth first search (BFS)

         In graph theory, breadth-first search (BFS) is a strategy for searching in a graph when search is limited to essentially two operations: (a) visit and inspect a node of a graph; (b) gain access to visit the nodes that neighbor the currently visited node. The BFS begins at a root node and inspects all the neighboring nodes. Then for each of those neighbor nodes in turn, it inspects their neighbor nodes which were unvisited, and so on. Compare BFS with the equivalent, but more memory-efficient Iterative deepening depth-first search and contrast with depth-first search.

BFS was invented in the late 1950s by E. F. Moore and initially used to find the shortest path out of a maze