RSA Encryption Using Fast Exponential Technique - Big Integer

Apr 17, 2012

I'm currently working on a RSA Encryption using Fast Exponential technique. As the numbers I'm working with will be very huge, I am forced to use BigInteger.

As this is the first time I'm using Big Integer, I encountered quite a number of issues. I'll try my best to explain the errors I'm facing:

1. I had done this step: BigInteger d;

So I'm currently trying to get d = 0;

However, I keep getting an error required: BigInteger, found int.

When I changed it to d = new BigInteger(0) , I get this error:

java:19: error: constructor BigInteger in class BigInteger cannot be applied to given types;

d = new BigInteger(0);
^
required: no arguments
found: int
reason: actual and formal argument lists differ in length

Part of Code:

public class BigFastExponential
{
BigInteger e; // public exponenet: all has this
BigInteger d; // private key: only key owner has this
BigInteger n; // public modulus: all has this

/**
* Create a LongRSA object for a public key holder, with just e and n.
*/
public BigFastExponential(BigInteger public_e, BigInteger public_n)

[Code] ....

View Replies


ADVERTISEMENT

Java Application That Calculates Exponential Function

Oct 5, 2014

There is an error in my code that pops when I tried to execute my java application for an exponent function that I wrote. Here is my code and here is the error is generated when I run my code:

//a java application that calculates the power of an integer in a method that the user creates
//and uses a while loop to do so. User cannot use any Math class methods to perform this calculation

import java.util.Scanner;
public class exponentiation{
//main method begins execution of java application
public static void main(String[] args){
 
[code]....

Why is it an illegal start of an expression? I didn't think you needed to used if statements for a whileloop.

View Replies View Related

Fast Fourier Transform Of Images

Jun 4, 2015

I have a problem that is associated with Fast Fourier Transform of an image. I've made an application with some filters for an images. It's a program with JLabels for displaying images before and after filtration and JButtons for filters. So, my problem is with FFT for an image, i've seen examples for that transformation, but i really don't know how to use that in my program.

View Replies View Related

Getting A Algorithm Format Of Butterfly Sub Division Technique?

Jul 16, 2014

Here is the Butterfly sub division technique which refines the mesh of a STL file.I have to prepare a java code based on this technique, give the step by step procedure or algorithm for this.(files attached)

View Replies View Related

Possibility To Use Pass By Reference Technique In Java

Aug 27, 2014

if there is a possibility to use the pass by reference technique in java like in C++.URL....

View Replies View Related

Creating Custom Fail-fast Iterator?

Feb 8, 2015

As part of a homework assignment in my 1st Java Class, I am creating my own Circular Generic LinkedList and Array class. My class uses the Queue Interface Extends Iterable but I am creating my own methods to work with. For the most part, I believe I have been successful in creating the class aside from one method. That method is the Iterator<E> iterator().

/**
* Return a fail-fast iterator, which throw a java.util.ConcurrentModificationException
* if the client modifies the collection (via enqueue(...) or dequeue()) during iteration.
*/
@Override
public Iterator<E> iterator() {

I don't understand how an iterator, let alone a "fail-fast" iterator ties into my project. I've spent hours reading up on a way to imploy my own generic fail-fast iterator but to no avail.

I feel like I could come up with some workable code if I knew what the point is to useing a user-defined, non Java Library iterator is to do.

As well, does throwing a ConcurrentModificationException require a try and catch block?

View Replies View Related

Implementing Fast Fourier Transformation Using Recursion

May 5, 2015

I'm trying to implement fast fourier transformation using recursion, at line 28 I'm getting null pointer exception.The algorithm is suppose to break the array in two parts computes real' and imaginary' at the end to each call stores the value in each call. After which further divide the array in two parts and compute.

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

[Code] ....

Windowing is left, I'll do it once this error is resolved.

View Replies View Related

Recursive Method Using Technique Calling Tree

May 9, 2014

a)Write a method that recursively displays any given character the specified number of times on one line.For example, the call: displayRowOf Characters(,5);

Produce a line: *****Write another method that uses a for-loop to perform the same process.

B is something like this ?
for (i=1; i<=n; i++)
i= '*' * n;
System.out.print(i);

View Replies View Related

Encryption - Decryption Alphabet

Mar 8, 2014

I want to create a java program that can be encrypt-decrypt alphabet from characters . Which is the shifting of the alphabet is starting from the the first character to increase 4 and 5 increased in the second character, increasing 6 at the third character, and so on..

Then when one of the characters increasement is more than the ascii code of 'z', that character will decrease from the variable i from the loop. This is the output of the program that i want:

Encryption:
Plain text: "abcz"
Cipher text: "egiz"

Decryption:
Cipher text: "egiz"
Plain text: "abcz"

This is my code for now:
 
package -;
 public class - {
 public static void main(String[] args) {
  String enkripsi = "abcz".toLowerCase();
String dekripsi = "egiz".toLowerCase();

[Code] ....

What's wrong with my code? It won't work. Specially in the decryption.

View Replies View Related

Java AES File Encryption

May 10, 2015

I have a program that encrypts and decrypts using the AES algorithm, but I have to specify the name of the encrypted file, and also specify the format of the original file as part of the name of the encrypted file. I will like to know how how to implement the following features into my code : 1.)I want the name of the encrypted file to be in cipherText 2.) i want the computer to be able to decide the file type(extension eg.txt) without me having to specify it, for example in my code if I am encrypting a .jpg file, I have to specify the name of the encrypted file as encrypt.jpg

Here is my code which i have tried to implement:

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.CipherOutputStream;

[Code] ....

To see if I could get the file name to be in cipher text but I got these errors:

Exception in thread "main" java.lang.NullPointerException
at java.lang.String.<init>(Unknown Source)
at EncryptDecrypt.encrypt(EncryptDecrypt.java:48)
at EncryptDecrypt.main(EncryptDecrypt.java:37)

View Replies View Related

How To Use RSA For Encryption / Decryption Of Large Files

Mar 14, 2015

I need to encrypt/decrypt file contents using RSA . But the default nature of RSA I could not upload files larger than 177 bytes for key length 1024 bytes . How it can avoid , I look it for a 100 times yet...

I attach my encryption files here ...

See attached files for more details ...

View Replies View Related

Simple Encryption / Decryption Program

Nov 1, 2014

I have to write an encryption/decryption program for a sentence entered by the user that uses arrays. Here is my code so far. I'm kind of lost on what to do next in the code.

import java.util.Scanner;

/*Program that encrypts then decrypts a sentence
Encryption
*/
public class Encryption extends java.swing.JFrame{

[code]....

View Replies View Related

Creating Encryption / Decryption Program?

Feb 25, 2015

For this week's assignment, I am supposed to create a java program that encrypt's a user's sentence, outputs the encrypted message, then decrypts the message, outputting the user's original message.

This is what I have so far. It doesn't compile the last few lines since that is not correct Java syntax.

Java Code:

import java.util.Scanner;
import java.io.*;
public class Decrypter {
public static void main(String[] args) {
String sentence;
final char REAL_ALPHA[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',

[Code] .....

So you can see I have "realAlpha" which are regular letters of the alphabet, and "codeAlpha" which are the letters I want to encrypt with. I want 'a' equal to 'z,' 'b' equal to 'y', 'c' equal to 'x' and so forth in that sort of reverse order, you know? So the word "apple" would encrypt into "zkkov."

I am stuck as to how to replace the letters in this way. You can see I tried fumbling with sentence.replace to switch the letters out between the two arrays. Also, I only barely understand arrays.

View Replies View Related

RSA Encryption Decryption Using Separate Codes With GUI

Aug 16, 2014

I am creating 2 different java codes for encryption and decryption separately based on RSA algorithm. The codes also involve swings for GUI. The problem with these codes are that my string is getting encrypted but after decrypting it,i do not get the string rather i get string of random numbers and alphabets. I am posting both the codes.

Encryption code:

import java.math.BigInteger;
import java.util.Random;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class cipher implements ActionListener

[Code] ....

Now the decryption code

import java.math.BigInteger;
import java.util.Random;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class decipher implements ActionListener

[Code] ....

The screenshots for respective codes are as attachments ....

View Replies View Related

Cipher Code - Encryption Test Cases Not Working

Oct 1, 2014

I have following Cipher Code and test for it. But I am getting following exception.

Java Code:

java.lang.IllegalStateException: Cipher not initialized
at javax.crypto.Cipher.checkCipherState(Cipher.java:1672)
at javax.crypto.Cipher.doFinal(Cipher.java:2079)
at com.anjib.util.CipherUtil.encrypt(CipherUtil.java:67)
at com.anjib.util.CipherTest.testEncryptDecrypt(CipherTest.java:23) mh_sh_highlight_all('java'); Java Code: public class CipherUtil {
private static Logger log = Logger.getLogger(CipherUtil.class);

[Code] ....

View Replies View Related

Encrypt / Decrypt User Sentence Using Array And Random Encryption

Oct 28, 2014

My assignment is to write a program that will encrypt and decrypt a sentence entered by a user but the encryption is to be random using an array. Can I convert my sentence(string) from char to int then create a random array to encrypt?

import java.util.Scanner;
import java.util.Random;
/*SentenceEncryptionProgram
*/
public class SentenceEncryption {
string sentence; //sentence entered by user

[Code] ....

View Replies View Related

Running Encryption / Decryption Application - Could Not Find Main Class

Jun 23, 2014

I am trying to put together an encryption/decryption application that will essentially accept a sentence that is submitted, and spit out the encrypted version and then switch it back to the correct sentence. I have been told to nest my information in the class (rather than the main), but am having difficulty actually understanding how to do this. The error that Eclipse is throwing me is also that it "could not find the main class." Here is my code:

import java.util.Arrays;
import java.util.Random;
public class encryptingWords {
public static void main(String[] args) {
final int ALPHASIZE = 26;
final char[] Lalpha =

[Code] .....

View Replies View Related

Encryption / Decryption - How To Separate Digits To Make Numbers Encrypted

Nov 4, 2014

I've written most of the code (along with another classmate) to get this to work, but I can't seem to return the encrypted value. I'm also trying to figure out how to separate the digits (or if I'm supposed to) to make the numbers encrypted. The main kicker is that we have to be using methods to return the final values. Everything compiles, (It compiles, but no results really.)

A company wants to transmit data over the telephone, but they are concerned that their phones may be tapped. All of their data is transmitted as four-digit integers. They have asked you to write a program that will encrypt their data so that it may be transmitted more securely. Your program should read a four-digit integer number and encrypt it as follows: Replace each digit by the remainder after (the sum of that digit plus 7) is divided by 10. Then, swap the first digit with the third, and swap the second digit with the fourth. Then print the encrypted integer. Do the encryption in a method and send the encrypted number back to main.

Here are the method headers: public static int encrypt(int num) // Takes num as a parameter and returns the encrypted value public static int getnum() // gets one number from the user Example: If the user enters 1234 they should see: 0189

import java.util.Scanner; //Needed for Scanner class
public class LNFI_LNFI_program2
{
public static void main(String[] args)
{
getnum(); //Calls for getnum() method

[Code] ....

View Replies View Related

JDBC :: Options Required For DB Schema Password Encryption - Connecting To Backend Database

Jul 9, 2015

We currently have an application which uses JDBC to connect to the backend database (DB version - 11.2.0.3 ). The application uses a properties file in which the password for the db schema is hardcoded in plain text format. Due to security restrictions we have been asked to make sure the password is encrypted in the file and no direct access is made to the schema using the plain text password. Best options we can use to make this password encrypted both at Oracle DB side and Java side.

View Replies View Related

Can't Seem To Get Value For Integer 1 And Integer 2 To Pass With SetValue Method

Aug 10, 2014

public class MyInteger {
private int value;
public MyInteger(int number){
value = number;
System.out.println("Constructor created with value of " + value);

[code]....

I can't seem to get the value for integer1 and integer2 to pass with the setValue method. I get a runtime error stating the I need to have an int value for these two integers.

View Replies View Related

JSP :: How To Browse And Read A File In Page To Perform Encryption For File

Nov 12, 2014

I am trying to create a file browse option in my jsp and later after browsing, all i want to do is to read that file in my jsp without saving it into that database so that i can perform encryption for it and save that encrypted file later into my database. please provide reference link so that i can refer to some applications and and move ahead with my work.

View Replies View Related

How To Validate And Integer From 0 - 9

Nov 5, 2014

I created a GUI with a jTextField as an input box and am wondering how to validate that this data is an integer from 0 - 9. Here is what I have. However the if statement shows an error that says int cannot be dereferenced.

private void doneButtonActionPerformed(java.awt.event.ActionEvent evt) {
//Create and Initialize Variable
int category = Integer.parseInt(categoryInput.getText());
if (category.matches(0-9)); //int cannot be dereferenced error here
{

[Code]...

View Replies View Related

Integer Sum In Generics

Mar 20, 2015

What is wrong in this

class Gen<k,v>
{
K a;
V b;
Gen(K s, V f) {
a=s;
b=f;

[Code] .....

a is object of type k,then how can I retrieve content of a?

View Replies View Related

How To Split The Integer

Jul 9, 2014

I am trying to split an integer for example my input is 0590

I want the output as

0

5

9

0

How to do this.

View Replies View Related

String In Integer Possible?

Apr 29, 2014

Code:
public static void main(String[] args) {
// TODO code application logic here
Calendar time = Calendar.getInstance();
int min = 1;//time.get(Calendar.MINUTE);
String blank = "0";
int checker = ((min > 10 ) ? min : blank+min);
System.out.println("The time is " + "12" + ":" + checker );
}

This is my code, as you can see, I have if the min is less than 10, display the string "0" next to it so it will be something like

blank is zero and min is one

So it will display as 01 but after min reaches 10 and above, the 0 goes away. Problem I have is, you just cant add "blank" to int checker because checker is an int and blank is a string. So what must I do in order for it to display the 0 under checker?

View Replies View Related

Integer Or Int For Loops

Mar 4, 2014

I would like to know which one is more appropriate to use in "for" loops or "while" loops.I don't know exactly when to use Integer or int.

for(int i=0; i<10; i++){ ... }
for(Integer i=0; i<10; i++){...}

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved