Pallavi Tumbigeremat

Greenhorn
+ Follow
since Dec 01, 2018
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Pallavi Tumbigeremat

Thanks a lot.
Done and I got the output and understood it also.
2 weeks ago
For now please help me in this and explain me so that I can get to know.
And I badly need that output please.
2 weeks ago
I want to get the same output as in the attached picture.
2 weeks ago
I am not trying to do anything new I am just trying to get output for one of my java lab program.
You can ask me what info you need to fix this.
2 weeks ago
So what is tat change which I can make in program or while giving frame bits in output?.
Please tell me what should I do to get the output without error
2 weeks ago
enter the frame bits
1011
generating polynomial10001000000100001
glen17
modified msg is10110
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 13
at java.lang.String.substring(String.java:1963)
at crc1.Crc1.crc(Crc1.java:29)
at crc1.Crc1.main(Crc1.java:68)
C:\Users\Palllvi T M\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 2 seconds)



no i got this error again. i changed as you said
2 weeks ago
so where should i make the change?
2 weeks ago
package rsa;

/**
*
* @author Palllvi T M
*/
import java.util.Scanner;

public class Rsa {
   public static int mult (int x,int y,int n){
       int k=1;
       int j;
       for(j=1;j<=y;j++);
       k=(k=x)%n;
       return k;
   }
public static int gcd(int m,int n){
   if (n==0)
       return m;
   else
       return (gcd(n,m%n));  
}
    /**
    * @param args the command line arguments
    */
   public static void main(String[] args) {
       // TODO code application logic here
int msg, PlainText,CipherText;
int n,d=0,e,z,p,q,i;
Scanner sc=new Scanner(System.in);
System.out.print("enter the values of primes p and q");
p=sc.nextInt();
q=sc.nextInt();
System.out.print("enter msg such that(msg is less than or equal to(p*q)-z");
msg=sc.nextInt();
n=p*q;
z=(p-1)*(q-1);
do{
   System.out.print("choose the value of e(e>z) such that gcd(z,e)=1:");
   e=sc.nextInt();
}while(gcd(z,e)!=1);
       i=2;
       while(((i*e)%z)!=1)
       {
   i++;
   d=i;
}
System.out.println("the public key pair is("+e+","+n+")");
System.out.println("the public key pair is("+d+","+n+")");
CipherText=mult(msg,e,n);
System.out.println("CipherText="+CipherText);
PlainText=mult(CipherText,d,n);
System.out.println("PlainText="+PlainText);

}
   }
   



output:
enter the values of primes p and q5 7
enter msg such that(msg is less than or equal to(p*q)-z30
choose the value of e(e>z) such that gcd(z,e)=1:5
the public key pair is(5,35)
the public key pair is(5,35)
CipherText=30
PlainText=30

is the output correct???
if not please tell me the changes
2 weeks ago
package crc1;
import java.util.*;
import java.io.*;
public class Crc1 {
   static String t;
  static String g="10001000000100001";
  static String cs;
  static int msglen;
  static int glen;
  static int totallen;
  void crc()

  {
      int i=g.length();
      cs=t.substring(0,glen);
      do
      {
          System.out.println("cs"+cs.charAt(0));
          if(cs.charAt(0)!='1')
              cs=cs.substring(1,cs.length());
          if(cs.length()==glen);
          cs=xor(cs,g);
          cs+=t.charAt(i++);
          System.out.println("cs"+cs);
      } while(i<totallen);
   
    }
  static String xor(String csstr,String gstr){
      int csint=Integer.parseInt(csstr,2);
      int gint=Integer.parseInt(gstr,2);
      System.out.println("csint"+csint);
      System.out.println("gint"+gint);
      int result=csint^gint;
      System.out.println("result"+result);
      return Integer.toBinaryString(result);
       
  }
   
  public static void main(String[] args) {
      // TODO code application logic here
      Scanner Sc=new Scanner(System.in);
      System.out.println("enter the frame bits");
      t=Sc.next();
      System.out.println("generating polynomial"+g);
      msglen=t.length();
      glen=g.length();
      System.out.println("glen"+glen);
      totallen=msglen+glen-1;
      for(int i=msglen;i<totallen;i++);
      {
          t+="0";
      }
      System.out.println("modified msg is"+t);
      new Crc1().crc();
      System.out.println("checksum is"+cs);
      t=xor(t,cs);
      System.out.println("final transmitted codeword is"+t);
      System.out.println("enter the recived msg");
      t=Sc.next();
      new Crc1().crc();
      if(cs.contains("1"))
      {
       System.out.println("error detected");
      }
       else
       {
                System.out.println("no errors found");
               }
  }
}



enter the frame bits
1011
generating polynomial10001000000100001
glen17
modified msg is10110
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 17
at java.lang.String.substring(String.java:1963)
at crc1.Crc1.crc(Crc1.java:29)
at crc1.Crc1.main(Crc1.java:68)
C:\Users\Palllvi T M\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 3 seconds)

i am still getting the error please help me as i have exam. and i am a beginner i wont get it tat easily
2 weeks ago
package crc1;
import java.util.*;
import java.io.*;
public class Crc1 {
    static String t;
   static String g="1000100000010000";
   static String cs;
   static int msglen;
   static int glen;
   static int totallen;
   void crc()

   {
       int i=g.length();
       cs=t.substring(0,glen);
       do
       {
           System.out.println("cs"+cs.charAt(0));
           if(cs.charAt(0)!='1')
               cs=cs.substring(1,cs.length());
           if(cs.length()==glen);
           cs=xor(cs,g);
           cs+=t.charAt(i++);
           System.out.println("cs"+cs);
       } while(i<totallen);
   
     }
   static String xor(String csstr,String gstr){
       int csint=Integer.parseInt(csstr,2);
       int gint=Integer.parseInt(gstr,2);
       System.out.println("csint"+csint);
       System.out.println("gint"+gint);
       int result=csint^gint;
       System.out.println("result"+result);
       return Integer.toBinaryString(result);
       
   }
   
   public static void main(String[] args) {
       // TODO code application logic here
       Scanner Sc=new Scanner(System.in);
       System.out.println("enter the frame bits");
       t=Sc.next();
       System.out.println("generating polynomial"+g);
       msglen=t.length();
       glen=g.length();
       System.out.println("glen"+glen);
       totallen=msglen+glen-1;
       for(int i=msglen;i<totallen;i++);
       {
           t+="0";
       }
       System.out.println("modified msg is"+t);
       new Crc1().crc();
       System.out.println("checksum is"+cs);
       t=xor(t,cs);
       System.out.println("final transmitted codeword is"+t);
       System.out.println("enter the recived msg");
       t=Sc.next();
       new Crc1().crc();
       if(cs.contains("1"))
       {
        System.out.println("error detected");
       }
        else
        {
                 System.out.println("no errors found");
                }
   }
}





output:
enter the frame bits
1011
generating polynomial1000100000010000
glen16
modified msg is10110
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 16
at java.lang.String.substring(String.java:1963)
at crc1.Crc1.crc(Crc1.java:29)
at crc1.Crc1.main(Crc1.java:68)
C:\Users\Palllvi T M\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned:1
BUILD FAILED (total time: 4 seconds)



Please help me debugging the logical error in this.i am looking forward for the reply ASAP.
2 weeks ago