Friday, 30 November 2012

how to create strong and secure password

It may happens you may spend an hour or two regulary everyday on Internet,but obivous you  will use few more social networking sites,few more e mails to cloud storage,few more net banking,and so on....so this would definately requires a password. People in this case would mostly use same password for all the accounts,

Now problem arise that this would be kind of spell disaster to you.
It may happens that one of your account is hacked,all other associated online accounts and properties would be at risk.


Therefore it is recommended to use a strong and long password.

What does good and strong password means??

-> 7 to 8 characters long
->avoid names,birth dates,common nouns,etc
->include uppercase and lowercase combined...in special case it is preferable to use symbols too.
->use numbers too
->seperate two different words with a number...example: hello123bye
->to make stronger enough use digit 0 instead of letter 'o' hel00123bye
->now suppose you have different accounts then you can go for the same password but with a minor changes..for example
    facebook: Fhell00123bye
    Gmail: Ghell00123bye
    Yahoo: Yhell00123bye
->If you still are not satisfied you can go for free password-making services such as passwordsgenerator. net or www. strongpasswordgenerator. org

WhatsApp reportedly fixes status error bug, warns users of hoax messages


WhatsApp has reportedly fixed the glitch that sprung up earlier this week that showed “error:uknown” as contact status. According to reports, the glitch had affected thousands of users worldwide.
WhatsApp acknowledged the glitch on Twitterand said it was working on resolving soon-ish. Here's WhatApp's message on Twitter:
The bug was followed by a hoax message urging people who use the app to forward a message to all their contacts or face having their accounts deleted.
The viral message is from the CEO of WhatsApp, one 'Jim Balsamic', and reads, "We have had an over usage of user names on whatsapp Messenger. We are requesting all users to forward this message to their entire contact list.
"If you do not forward this message," the message continues, "we will take it as your account is invalid and it will be deleted within the next 48 hours.
"Please DO NOT ignore this message or whatsapp will no longer recognise your activation," the fake communcation orders, warning, "If you wish to re-activate your account after it has been deleted, a charge of 25.00 will be added to your monthly bill."
According to Naharnet, WhatsApp has assures its users on circulated messages calling them hoax. The site quotes a Whatsapp blog as saying “We have been getting a lot of emails and questions from you about a chain letter message circulating in our network. Please understand that this is a hoax and there is no truth to it.
“While we are flattered that we made it Hoax Slayer we would rather work on cool new features instead of debunking silly stories like these.”
It's not the first time such hoax message has surfaced. WhatsApp confirms on its blog that a very similar message went viral back in January. According to Cnet, the spam appears to have started “BlackBerry messaging service BBM -- hence Jim Balsamic, a vinegar-flavoured corruption of Jim Balsillie, former co-CEO of RIM”. Check out the past messages that have done rounds of WhatsApp

Thursday, 29 November 2012

Some Useful Java Links

Readers,
          These are some useful java links...A single line description has been tagged for your reference.



Wednesday, 28 November 2012

Download TC 3

Turbo C Free Download


Step 1
        Download the file from here

Step 2
        Extract the zip folder

Step 3
        Click on Install.exe in tc3 folder

Tuesday, 27 November 2012

Diffie Hellman (Java)

Diffie Hellman: Receiver

import java.io.*;
import java.net.*;
import java.util.*;

public class DeffieHellmanRcv {

DatagramSocket theSocket = null;

int serverPort = 9999;
Scanner sc;
int y,g,p,r2;

DatagramPacket theRecievedPacket;
DatagramPacket theSendPacket;
InetAddress clientAddress;
int clientPort;
byte[] outBuffer;
byte[] inBuffer;

public DeffieHellmanRcv()
{
try {
// create the server UDP end point
theSocket = new DatagramSocket(serverPort);

System.out.println("Bob");
} catch (SocketException ExceSocket)
{
System.out.println("Socket creation error : "+ ExceSocket.getMessage());
}
}

public void keyGen()
{

sc=new Scanner(System.in);

System.out.print("Enter p=");
p=sc.nextInt();

System.out.print("Enter g=");
g=sc.nextInt();


System.out.print("Enter y=");
y=sc.nextInt();

r2= (int)(Math.pow(g,y)) % p;
//System.out.println("R2= "+r2);

}

public void send()
{
try
{
String message =r2+"";
System.out.println("Message Send:"+message);
//System.out.println("Message  sent: "+message);
outBuffer=message.getBytes();

System.out.println(message);
// send some data to the client
theSendPacket = new DatagramPacket(outBuffer, outBuffer.length, clientAddress, clientPort);
theSocket.send(theSendPacket);
}

catch (Exception e)
{
System.out.println("Error with client request : "+e);
}
// close the server socket


}

public void receive()
{


// create some space for the text to send and recieve data
outBuffer = new byte[500];
inBuffer = new byte[50];

try
{
// create a place for the client to send data too
theRecievedPacket = new DatagramPacket(inBuffer, inBuffer.length);

// wait for a client to request a connection
theSocket.receive(theRecievedPacket);
//System.out.println("Client connected");

// get the client details
clientAddress = theRecievedPacket.getAddress();
clientPort = theRecievedPacket.getPort();



String message = new String(theRecievedPacket.getData(),0,theRecievedPacket.getLength());


String sendData = message+"";
System.out.println("Message Recieved: "+message);
System.out.println(sendData);
outBuffer = sendData.getBytes();


int k2=(int)(Math.pow((Integer.parseInt(message)),y))%p;


System.out.println("\n\nk2= "+k2);

}
catch(Exception e)
{
System.out.println("E2"+e);
}

}





public static void main(String[] args)
{
DeffieHellmanRcv dr = new DeffieHellmanRcv();
dr.keyGen();
dr.receive();
dr.send();
}
}

Download the code from here

Knapsack Cryptosystem: Decryption (Java)


Knapsack Cryptosystem: Decryption


import java.util.*;
class KSD
{
public int inverse(int a,int n)
{
int r1,r2,r,q,t1,t2,t;
r1=n;r2=a;
t1=0;t2=1;
while(r2>0)
{
q=r1/r2;
   r=r1-q*r2;
   t=t1-q*t2;

   r1=r2;r2=r;
   t1=t2;t2=t;
}
 if(r1==1)
  return t1;
 else
  return 0;
}
public void invKnapSack(int a[],int s,int p[])
{
int s2,sum=0;
int x[]=new int[7];
int t[]=new int[7];

System.out.println("\n\n i\ta\ts\tx\ts\n");
for(int h=6;h>=0;h--)
{
if(s>=a[h])
{
x[h]=1;
}
s2=s-(a[h]*x[h]);
System.out.println(h+"\t"+a[h]+"\t"+s+"\t"+x[h]+"\t"+s2);
s=s2;
}

/*for(int h=0;h<7;h++)
System.out.print(x[h]);*/
for(int h=0;h<7;h++)
t[h]=x[p[h]-1];
System.out.println();
for(int h=0;h<7;h++)
{
int temp;
if(t[h]==1)
{
temp=(int)(Math.round((Math.pow(2,7-h-1))));
sum+=temp;
}
}
char ch=(char)sum;
System.out.println("The plain text is: "+ch);
}
}
class KnapSackDecrypt
{
public static void main(String args[])
{
int b,n,r;
int a[]=new int[7];
int p[]=new int[7];
Scanner se=new Scanner(System.in);
System.out.println("Enter the super increasing tuple: ");
for(int h=0;h<7;h++)
a[h]=se.nextInt();
System.out.println("Enter the permutation tuple: ");
for(int h=0;h<7;h++)
p[h]=se.nextInt();
System.out.println("Enter the cipher text (sum) : ");
b=se.nextInt();
se.nextLine();
System.out.println("Enter the N: ");
n=se.nextInt();
se.nextLine();
System.out.println("Enter the R: ");
r=se.nextInt();
//System.out.println(b);
KSD ksd=new KSD();
int s=ksd.inverse(r,n);
s*=b;
s%=n;
System.out.println(s);
ksd.invKnapSack(a,s,p);
}

}

Download the code from here

Multiplicative Cipher (C++)

Multiplicative Cipher : Encryption

#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<ctype.h>
class MulCiph
{
  public:
  char str[100];
  int key;
  void getkey();
  void gettext();
  void convert();
};
void MulCiph :: gettext()
{
  cout<<"\nEnter the string: ";
  cin>>str;
}
void MulCiph :: getkey()
{
  cout<<"\nEnter the multiplicative cipher key: ";
  cin>>key;
}
void MulCiph :: convert()
{
  int h=strlen(str);
  for(int i=0;i<h;i++)
  {
    char c=(((toascii(str[i])-97)*key)%26)+97;
    cout<<str[i]<<"\t"<<((toascii(str[i])-97)*key)%26<<"\t"<<c<<endl;
  }
}
void main()
{
  clrscr();
  MulCiph a;
  a.gettext();
  a.getkey();
  a.convert();
  getch();
}

Download the code from here