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

Additive Cipher (C++)


Encryption using Additive Cipher in C++


#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<ctype.h>
class AddCiph
{
  public:
  char str[100];
  int key;
  void getkey();
  void gettext();
  void convert();
};
void AddCiph :: gettext()
{
  cout<<"\nEnter the plain string: ";
  cin>>str;
}
void AddCiph :: getkey()
{
  cout<<"\nEnter the additive cipher key: ";
  cin>>key;
}
void AddCiph :: 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();
  AddCiph a;
  a.gettext();
  a.getkey();
  a.convert();
  getch();
}

Download code from here


How to use clrscr() in Netbeans

How to use clrscr() in NetBeans



This is specially for NetBeans users. Sometimes you might be facing some problems when you have to use "clrscr()" in C/C++ in NetBeans.
The reason is the NetBeans IDE does not supports conio.h header file and "clrscr()" is included in that library.
So this is the how you can use clrscr() alternate and clear the screen.

IPv6 internet addressing now available in India

Indian Registry for Internet Names and Numbers (IRINN) has started issuing next version of internet addresses 'IPv6', which would make it easy for security agencies to identify each internet user. 
The internet addresses under the present version IPv4 (Internet Protocol version 4), are limited and service providers often assign single IP address to many users, making it difficult to identify the end user. 
"The number of IPv6 addresses available is enormous. ISPs (Internet Service Providers) can allocate an IP address to their users. People can be easily identified if they are using IPv6," APNIC Director (Services and Operations) Sanjaya said at the roadshow for new version IPv6 here today. 
APNIC, which is one of the five authorised bodies for issuing internet addresses, has recognised Indian Registry for Internet Names and Numbers (IRINN) for issuing IP addresses in India. 
"We are issuing IPv6 addresses at up to 60 per cent less than prevailing rates in the ongoing soft launch period. This is to test compatibility of hardware and softwares that has to be in place. In next couple of months we will launch industrial grade of IPv6," National Internet Exchange of India (NIXI) Chief Executive Govind said. 
IRINN has been set-up under the state-run NIXI. On new version IPv6, Internet Service Providers Association of India President Rajesh Charia said that the new addresses will be multiple times cheaper for companies than IPv4 addresses. 
IRINN is issuing initial set-of IPv6 addresses in price range starting at Rs 21,999 compared to prevalent rate of around Rs 66,000 in Asia Pacific region. 
On addressing security issues with the help of IPv6, Charia said, "Government will have to ensure that the new equipment and devices that are produced or imported in the country are at least IPv6 enabled." 
At present, there is no import restriction on devices and equipment that do not comply with IPv6 standards.


Thursday, 8 November 2012

Knapsack Cryptosystem: Encryption (Java)


import java.util.*;
class KnapSack
{
public void calculateKnapSack(char ch,int b[],int p[],int n,int r)
{
int pt=ch;
int sum=0;
String str=Integer.toBinaryString(pt);
int t[]=new int[7];
int a[]=new int[7];
int x[]=new int[7];
for(int h=0;h<7;h++)
t[h]=(b[h]*r)%n;
System.out.print("\nTemparory Tuple:\t\t\t");
for(int h=0;h<7;h++)
System.out.print(t[h]+",");
for(int h=0;h<7;h++)
a[h]=t[p[h]-1];
System.out.print("\nAfter Permuting Temporary Tuple:\t");
for(int h=0;h<7;h++)
System.out.print(a[h]+",");
for(int h=0;h<7;h++)
x[h]=str.charAt(h)-48;
System.out.print("\nAfter (b*n)%r:\t\t\t\t");
for(int h=0;h<7;h++)
System.out.print(a[h]*x[h]+",");
for(int h=0;h<7;h++)
sum+=a[h]*x[h];
System.out.println("\n\nThe Sum and the Cipher Text is:"+sum);
System.out.println();
}
public static void main(String args[])
{
String ch;
Scanner se=new Scanner(System.in);
System.out.println("\nEnter the plain text: ");
ch=se.nextLine();
char pt=ch.charAt(0);
int b[]=new int[7];
int p[]=new int[7];
System.out.print("Enter the value of N: \n");
int n=se.nextInt();
System.out.print("Enter the superincreasing tuple upto 7: \n");
for(int i=0;i<7;i++)
b[i]=se.nextInt();
System.out.print("Enter the permutation tuple upto 7: \n");
for(int i=0;i<7;i++)
p[i]=se.nextInt();
KnapSack l=new KnapSack();
l.calculateKnapSack(pt,b,p,n,41);
}
}



Download the code from here

GCD using Euclidian Method (C++)


#include<iostream.h>
#include<conio.h>
class GCD
{
  public:
    int a,b,q,r,tempa,tempb;
    void getdata();
    void calculate();
};
void GCD :: getdata()
{
  cout<<"\nEnter the value of A: ";
  cin>>a;
  tempa=a;
  cout<<"\nEnter the value of B: ";
  cin>>b;
  tempb=b;
}
void GCD :: calculate()
{
  while(tempb>0)
  {
    q=tempa/tempb;
    r=tempa-(q*tempb);
    cout<<q<<"\t"<<tempa<<"\t"<<tempb<<"\t"<<r<<"\n";
    tempa=tempb;
    tempb=r;
  }
  cout<<"GCD("<<a<<","<<b<<") is"<<tempa<<"\n";
}
void main()
{
  clrscr();
  GCD g;
  g.getdata();
  g.calculate();
  getch();
}


Download the CPP file from here