7/23/2014

Shift Cipher Code

Shift Cipher:
Another encryption algorithm yet les powerfull than RSA is shift cipher algorithm.
And caesar cipher is a special case of shift cipher where key=3



But the code provided below works for any alphabetical word and not for symbols and no's and even Capital alphabets.




RSA Algorithm Code

I would like to share some 100% workiing programs which are generally included in Computer Science & Engineering Subjects like Network Security.
Encryption Algorithm :-
RSA is an encryption algorithm used to transfer data securely on network.
It is an asymmetric algorithm as there are two keys one for locking the message and other for opening the message.

RSA Algorithm in java for number  as input.

/*Author Name:Bhanupratap Singh
    Date:11/03/2014
    Subject:Internet and Network Security
*/
import java.math.BigInteger;
import java.math.BigInteger.*;
import java.util.*;
class RSA
{
    BigInteger cTextValue,cdTextValue;
    int count=0,err[],pTextValue,q,e,d,n,func_n,p;
    Scanner sc =new Scanner(System.in);
    public void getInput()
    {
        System.out.println("Enter the plaintext");
        pTextValue=sc.nextInt();   
        System.out.println(pTextValue);
        System.out.println("Enter the value of p");
        p=sc.nextInt();
        System.out.println("Enter the value of q");
        q=sc.nextInt();
    }
    public int gcd(int a,int b)
    {
        if(b==0)
        return a;
        return gcd(b,a%b);
    }
    public void keyGenerator()
    {   
        n=p*q;
        func_n=(p-1)*(q-1);
        err=new int[func_n];int j=0;
        for(int i=2;i<func_n;i++)
        {
        if(gcd(i,func_n)==1)
            {
               
                    e=i;
                    err[j]=e;
                    j++;
            }           
        }
        for(int l=0;l<func_n;l++)
        {
            if(err[l]==0)
            break;           
            else
            count++;
        }
        System.out.println("The posssible values of e are :");
        for(int c=0;c<count;c++)
        System.out.println(c+") "+err[c]);
        System.out.println("Enter the value of e you would like to use from displayed options...");
        e=sc.nextInt();
        for(int k=1;k<func_n;k++)
        {
        if(((k*e)%func_n)==1)
            {
            d=k;
            break;
            }
        }
        System.out.println("Public key: "+"{"+e+","+n+"}");
        System.out.println("Private key: "+"{"+d+","+n+"}");
    }
    public BigInteger calculate(int a,int b,int n1)
    {
        BigInteger c=new BigInteger(Integer.toString(a));
        BigInteger d=new BigInteger(Integer.toString(b));
        BigInteger n2=new BigInteger(Integer.toString(n));
        BigInteger res=c.modPow(d, n2);
        return res;
    }
     public BigInteger calculate(BigInteger a,int b,int n1)
    {
        BigInteger c=a;
        BigInteger d=new BigInteger(Integer.toString(b));
        BigInteger n2=new BigInteger(Integer.toString(n));
        BigInteger res=c.modPow(d, n2);
        return res;
    }
    public void enCryption()
    {   
        cTextValue=calculate(pTextValue,e,n);
        System.out.println("The cipher text value is: "+cTextValue);
    }
    public void deCryption()
    {
        cdTextValue=calculate(cTextValue, d, n);
        System.out.println("The plain text value is: "+cdTextValue);
    }
}

public class RSADemo {
    public static void main(String args[])
    {
    RSA r=new RSA();
    r.getInput();
    r.keyGenerator();
    r.enCryption();
    r.deCryption();
    }
   
}
/*OUTPUT
C:\Users\Home-Technology\Desktop\InsJava>javac RSADemo.java

C:\Users\Home-Technology\Desktop\InsJava>java RSADemo
Enter the plaintext
5
5
Enter the value of p
7
Enter the value of q
11
The posssible values of e are :
0) 7
1) 11
2) 13
3) 17
4) 19
5) 23
6) 29
7) 31
8) 37
9) 41
10) 43
11) 47
12) 49
13) 53
14) 59
Enter the value of e you would like to use from displayed options...
41
Public key: {41,77}
Private key: {41,77}
The cipher text value is: 38
The plain text value is: 5
*/


The sbove code will work for any key and plaintext.
NOTE:But plaintext should be a number .





Activate IDM to full version(Method 2)

I have noticed that previous methods of IDM Activation have a drawback that after some period of time it shows message that IDM is registered with fake serial key.

  1. To get rid of this download the patch from click here to download patch
  2. Extract the patch file.Please disable your antivirus before downloading and extracting.
  3. Double click on patch,you will see an image as below:

     4. Click   on patch.
     5. It will prompt for IDM directory,locate it in C:program files/internet download manager    folder and click on IDM.exe file and click open.
      6.The patch will prompt for enter name "Enter anything in the prompts and click ok".
     7. You will get a patch successfull prompt.
     8. Congrats!! You have successfully patched the IDM.
Note:This method have a problem that whenever IDM is active you will get the prompt that IDM is registered with fake serial key in regular intervals.& you have to bear that until I get some other method.
Just close that dialog and continue your work.
And if you aren't downloading anything through IDM just right click n notification area icon and Exit IDM.
You will get no further annoying prompts until IDM is running again.
    Congratulations!!!! You have activated IDM to ful version. 

    How to use Tuneup Utilities to optimize your PC for best performance?

    TuneUp utilities automatically ask for one click maintenance after installation.
    Allow it to scan perform changes to your system.It performs following task fo you:
    • Disk defragmentation
    • Clean Registry
    • Removing broken shortcut
    • Clean up windows & programs
    • Clean up browser
    • Optimize system startup & shutdown
    This is shown in the figure below:


    After all the operations have been completed in one click maintenance,restart your PC & you  will notice increase in performance.

    You can even access this by starting the tuneup utilties dashboard & clicking on scan button in Maintenance tab.
    You can perform other optimizing tricks by clicking on All Functions tab.
    You can also set up Turbo Mode by clicking on Turbo button under PC Mode section on Dashboard.
    A dialog will appear which will guide you through the further set up,select options in the dialog as per your requirement.And then enable the Turbo Mode.
    Your PC performance will increase many times.
    Enjoy, fast PC.

    7/22/2014

    What are the Softwares for Optimizing Windows for best performance?

    Advanced System Optimizer
    Two in antivirus+system optimizer
    • Solves registry issues and vulnerabilities after scanning your PC
    • It also have an inbuilt antivirus which is very small in size but is not trustable as it may not be able to scan all the antivirus.
    • Its other benefit is a gaming mode, and ASO is the only optimisation tool to offer this. Any game you specify is run in a virtual desktop, so you can switch between it and your real desktop quickly. 
    Norton Utilities
     
    • You'll find a Registry cleaner, service management, defragmentation tools and start-up tool.
    • One nice touch is that Norton can apply fixes instantly without a system reboot thanks to a Refresh Windows setting.
    • Norton Antivirus are considered to be one of the best antiviruses in market,but its tuneup utilities doesn't stand upto the mark.

     CCleaner
    • It has tools to clean drive,remove broken shortcuts, defragment disk,registry cleaner,web browser cleaner,etc.
    • It also has a tool known as drive wiper which takes long time but performs complete cleanup of the system.
    • Inspite of all these features,it doesn't improve the performance of the system.

     TuneUp Utilities
    • In all of the tuneup utilities,the performance optimization done by Tune Up Utilities is remarkable and magnificient.
    • It have many features ranging from registry cleaner to disk defragment.
    • And three modes of operation:-
    1. Turbo Mode.
    2. Economy Mode.
    3. Standard Mode.
    • Turbo mode improves the system performance many times.
                                           Ashampoo WinOptimizer
    • The software's cramped interface includes a handy summary of your system's hardware and settings, along with maintenance categories, plus CPU and RAM speedometers.
    • Optional settings like Live-Tuner and Hibernation File can be switched on and off from here, but WinOptimizer offers no explanation as to what these toggles actually do.
    • It feels like a piece of software that will benefit office and internet users more than it will gamers, and a decent Peacekeeper score backs this up. 



    How to Optimize Windows for best performance?




    We generally get mad at our PCs(Personal Computers), the reasons can be any of the following:-
    1. Slow startup generally when it takes more then 60 seconds.
    2. Slow shutdown Or Sometimes when an error message pops-up while shutdown.
    3. And sometimes viruses are the cause.
    Today I will be providing you with some simple steps to boost up your PC startup speed----->>>>>

    At computer's startup many other programs along with the OS are loaded into memory due to which we experience slow startup.
    Some of these programs are:-
    1. Antivirus's which are generally huge and bulky.
    2. Audio & Video drivers.
    3. Also while installing some softwares we knowingly or unknowingly configure that program to start at startup,but these programs increase your startup time.
    So to speed up your computer you just need to stop some of these programs from starting  at startup.
    We can't risk by stopping antivirus to start at startup,nor can we stop audio and video drivers to load at startup because they are important.
    Then only remained is the other set of programs which is  of not much importance to start at startup.So to stop these programs follow the steps below:--->>>
    1. Go to Start 
    2. Now click on either Run and then type msconfig or directly type in search box and hit Enter.
    3. System Configuration Utility dialog box appears.
    4. Go to startup tab .In that tab uncheck those programs which you didn't want to start at startup then click on apply.
    5. Now go to Services tab in the bottom check Hide All Microsoft Services then all non Microsoft services list will be displayed.
    6. Now click on Disable all button and then click on apply and finally click on Ok.
    7. Now restart your Computer you will notice increase in your startup speed.
    Also you can defragment your disk,though it takes little long to complete but it increases the computer speed considerably.Fllow the steps below:-

    1. Double Click on My Computer.
    2. Now right click on the drive in which your Windows is installed(Generally it is the C Drive) and click on properties.
    3. Now click on Tools tab and then click on Defragment now... button,a dialog box appears.Now click on Defragement Disk.
    4. Be patient, it will take a time to defragment depending on space filled on the  drive.
    5. You must defragment your disk frequently when you install a large or bulky softwares on your system.  
    6. If you still having slow PC problem then download TuneUp Utilities 2014 from the link below:
      And be sure to activate the product to get complete benefits from it.
      To activate the product enter the serial key below whenever prompted to: 
      TMACO-HRNAV-OZGB2-ADQKE-WC2K2-XCY2J
      NOTE:But if you use turbo mode in tuneup utilities then you will experience that your performance has been boosted.But you will notice that visual effects would be reduced as they take more space in memory tuneup utility disables it.

      In my next post I will post about using TuneUp Utilties for best performance of PC.
      So keep reading!!!
       

    Cygwin Compiler for C/C++

    What...


     ...is it?

    Cygwin is:
    • a large collection of GNU(GNU's Not Unix!) and Open Source tools which provide functionality similar to a Linux distribution on Windows.
    • a DLL (cygwin1.dll) which provides substantial POSIX API functionality. 

     ...isn't it?
    • a method to run native Linux apps on Windows.
     Cygwin can be used to compile & execute C,C++,FORTRAN and many other language programs. 

    Notes:
    POSIX-
    Portable Operating System Interface is a  family of standards specified by the IEEE for maintaining compatibility between operating systems. POSIX defines the application programming interface (API), along with command line shells and utility interfaces, for software compatibility with variants of Unix and other operating systems.