Tuesday, February 15, 2011

Quote of the day

Quote of the day :

For rebellion is as the sin of witchcraft, and stubbornness is as iniquity and idolatry.
Bible : 1 Samuel

Friday, February 11, 2011

Humorous Quotes for the day

Quotes for today :
  • "Better to remain silent and be thought a fool than to speak out and remove all doubt."
- Abraham Lincoln 

  • "Early to rise, Early to bed, Makes a man healthy but socially dead."
    - The Warner Brothers (Animaniacs)

  • Courtesy

Monday, February 7, 2011

Iterator,Set and Encryption Example

import java.security.Provider;
import java.security.Security;
import java.security.MessageDigest;
import java.util.Iterator;
import java.util.Set;


public class cipher1 {
    public static void main(String args[]) throws Exception
    {
        // Get the Provider List
        Provider p[]=Security.getProviders();
        // First record of Providers
        // Get the Keyset
        Set v_set=p[0].keySet();
       
        // Get the Iterator to operate upon
        Iterator itr=v_set.iterator();
       
        // Key and Value String Variables
        String v_key;
        String v_value;
        while(itr.hasNext())
        {
            v_key=(String)itr.next();
            v_value=p[0].getProperty(v_key);
            System.out.println("Key is "+v_key);
            System.out.println("Property Value is "+v_value);       
        }
        // Use the key value as input
        // Example :
        // Key of type Key is MessageDigest.SHA-512
        // Name would be DSA (contents after the dot(.)
        System.out.println("SHA-1 Encrypted Code "+encrypt("Ajith","SHA-1"));
        System.out.println("MD5 Encrypted Code "+encrypt("Ajith","MD5"));
        System.out.println("MD5 Encrypted Code "+encrypt("Ajith","MD5"));
        System.out.println("MD2 Encrypted Code "+encrypt("Ajith","MD2"));
        System.out.println("SHA-256 Encrypted Code "+encrypt("Ajith","SHA-256"));
        System.out.println("SHA-512 Encrypted Code "+encrypt("Ajith","SHA-512"));
       
    }

    // This function takes String to be encrypted and encryption alogrithm name
    // and returns the encrypted byte Array
   
    public static byte[] encrypt(String v_str,String v_alg_name) throws Exception
    {
        java.security.MessageDigest d=null;
        d=java.security.MessageDigest.getInstance(v_alg_name);
        d.reset();
        System.out.println("Bytes are "+v_str.getBytes());
        d.update(v_str.getBytes());
        return d.digest();
    }
}

Humourous Quotes for the Day

My Picks of Quotes for the day :

Don't worry about the world coming to an end today.  It is already tomorrow in Australia.



"Man is the only animal that laughs and weeps; for he is the only animal that is struck with the difference between what things are, and what they ought to be."


"Three things can't be hidden: coughing, poverty, and love."


"No man is truly married until he understands every word his wife is NOT saying."
( Well Said )


"It is not uncommon for slight acquaintances to get married, but a couple really have to know each other to get divorced."
( I like this one specially, so true)

Saturday, February 5, 2011

Humourous Quotes for the Day

Picks for Weekend Quotes

  • My way of joking is to tell the truth. It's the funniest joke in the world.
     

  • Give a man a fish and he has food for a day; teach him how to fish and you can get rid of him for the entire weekend. 


  • Humor is emotional chaos remembered in tranquility.


  • Everything is changing. People are taking the comedians seriously and the politicians as a joke




  • Angels can fly because they take themselves lightly; devils fall because of their gravity.