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


ADVERTISEMENT

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

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

Program That Continuously Asks For Alphabet Letter And Stops When Non-Alphabet Letter Entered

Oct 8, 2014

Write a program that continuously asks for an alphabet letter, and stops when a non-alphabet letter is entered. Then output the number of upper case letters, lower case letters, and vowels entered ....

View Replies View Related

Letters Of A String That Occur From Second Half Of Alphabet

Feb 11, 2014

Write a method named secondHalfLetters that accepts a string as its parameter and returns an integer representing how many of letters in the string come from the second half of the alphabet (that is, have values of 'n' through 'z' inclusive). Compare case-insensitively, such that uppercase values of 'N' through 'Z' also count. For example, the call secondHalfLetters("ruminates") should return 5 because the 'r', 'u', 'n', 't', and 's' come from the second half of the alphabet. You may assume that every character in the string is a letter.

View Replies View Related

Encrypt Strings Present In Array To Alphabet After 2 Positions

Mar 13, 2014

I have to encrypt the strings present in an array to the alphabet after 2 positions

Example:

my name is x

should give an output

oa pcog ku z

Although i have taken an input but unable to increment the char in the array...

View Replies View Related

Encoder - Possibility Of Shift Being Larger Than Alphabet Array Length

Apr 20, 2015

I have an encoder that will shift the character of a string X places. Im trying to account for the possibility of the shift being larger than alphabet array length. I've come up with the following, but I still get an ArrayIndexOutOfBounds Error and it never gets past the if statement.

private String encryption(char charArrayElement) {
String [] alphabet = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L",
"M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
String str = String.valueOf(charArrayElement);

[Code] ....

View Replies View Related

Exception In PGP Decryption

Oct 16, 2014

I want to encrypt and decrypt a txt file by using PGP.I completed my PGP Encryption.I'm getting an error in PGP Decryption. The error msg as follows

Quote:

Exception in thread "main" java.lang.IllegalArgumentException: Invalid PGP message
at com.newpackage.bouncy.PGPUtils.getDataList(PGPUtil s.java:502)
at com.newpackage.bouncy.PGPUtils.decryptFile(PGPUtil s.java:198)
at com.newpackage.bouncy.PGPFileProcessor.decrypt(PGP FileProcessor.java:56)
at com.newpackage.bouncy.Tester.testDecrypt(Tester.ja va:46)
at com.newpackage.bouncy.Tester.main(Tester.java:61)

I am getting this error in the following line of my code.

PGPObjectFactory factory=new PGPObjectFactory(PGPUtil.getDecoderStream(is));
=>> Object obj=factory.nextObject();//here i am getting obj as null
if (obj == null) {
//System.out.println("Invalid PGP Message");
//System.exit(0);

[Code] .....

View Replies View Related

Decryption - Data Must Not Be Longer Than 128 Bytes

Oct 21, 2014

Button Code:

private void DecryptBActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
final String plainText;
if (!areKeysPresent()) {
// Method generates a pair of keys using the RSA algorithm and stores it
// in their respective files
generateKey();

[Code] ....

Everytime throwing exception "javax.crypto.IllegalBlockSizeException: Data must not be longer than 128 bytes" in decrypt method.

View Replies View Related

Access Restriction Error In Decryption Code

May 21, 2015

I am getting error message on Java code that was developed by someone else and is supposed to work.

public String decrypt(String password) {
try {
// create the key and parameter spec
KeySpec keySpec = new PBEKeySpec(password.toCharArray(), salt, interactions);
SecretKey key = SecretKeyFactory.getInstance(keyFormat).generateSecret(keySpec);
AlgorithmParameterSpec paramSpec = new PBEParameterSpec(salt, interactions);
// create the cipher

[code]...

the error message is as follows: Access restriction: The type 'BASE64Decoder" is not API (restriction on required library '/usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/lib/rd.jar')I am using eclipse.

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

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 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

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

Build Up Alphabet Character By Character

Mar 9, 2014

I am trying to build up the alphabet character by character. Like:

a
ab
abc
abcd

Well as of now I can only print out the alphabet with my loop like abcdefg...z.. So here is the code I am trying to use:

public void loop4() {
char alph = 'a';
while(alph <= 'z') {
System.out.println(alph);
alph++; 
}
}

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







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