473,386 Members | 1,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Encryption and Decryption

Hai,
I am facing one problem in Encryption(Java). I want to get a string from the user and split that string into characters. After splitting that string into characters, i am changing that character into integer and adding some value to it. what my problem is after adding that value i want change that into String and Store that String in the database.


Thanks in Advance
Nov 23 '06 #1
5 1385
sivadhas2006
142 100+
Hi,

Can you post your java code?

Regards,
M.Sivadhas.
Nov 23 '06 #2
sivadhas2006
142 100+
Hi,

Try this..

Expand|Select|Wrap|Line Numbers
  1. int i = 10;
  2. String strTest = Integer.toString(i)
  3. or 
  4. String strTest = "" + i
  5.  
  6.  
Regards,
M.Sivadhas.
Nov 23 '06 #3
Hi,

Can you post your java code?

Regards,
M.Sivadhas.

import java.io.*;
import java.lang.*;

class encrypt1
{

public static void main (String args[])
{

String name="welcome";
char ch[]=new char[20];
int j;
char c1;
for(int i=0; i<=name.length()-1; i++)
{
ch[i]=name.charAt(i);
j=ch[i]+5;
c1=(char)j;
System.out.println(c1);
}
}
}
Nov 23 '06 #4
try this code. the changed character is stored in a string.hope it ll be useful. if i havent met ur expectations, pls lemme knw.

public class testSample {

public static void main (String args[])
{
String name="welcome";
String str = "";
char ch[]=new char[name.length()];
char character[]=new char[name.length()];
int j;
char c1;
for(int i=0; i<=name.length()-1; i++)
{
ch[i]=name.charAt(i);
//System.out.println("char is -----"+ch[i]);
j=ch[i]+5;
//System.out.println("j value is ---"+j);
c1=(char)j;
character[i]=c1;
System.out.println("c1 value is---"+c1);
System.out.println("character array----"+character[i]);
}
System.out.println("char array length is---"+ch.length);
int charLength = character.length;
for(int i=0; i<charLength-1;i++){
str= str + character[i];
}
System.out.println("the string is---"+str);
}
}
Nov 24 '06 #5
Hai,

Thanks a Lot. I got the exact output.

try this code. the changed character is stored in a string.hope it ll be useful. if i havent met ur expectations, pls lemme knw.

public class testSample {

public static void main (String args[])
{
String name="welcome";
String str = "";
char ch[]=new char[name.length()];
char character[]=new char[name.length()];
int j;
char c1;
for(int i=0; i<=name.length()-1; i++)
{
ch[i]=name.charAt(i);
//System.out.println("char is -----"+ch[i]);
j=ch[i]+5;
//System.out.println("j value is ---"+j);
c1=(char)j;
character[i]=c1;
System.out.println("c1 value is---"+c1);
System.out.println("character array----"+character[i]);
}
System.out.println("char array length is---"+ch.length);
int charLength = character.length;
for(int i=0; i<charLength-1;i++){
str= str + character[i];
}
System.out.println("the string is---"+str);
}
}
Nov 24 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: D. Alvarado | last post by:
On my Fedora Core 2 Linux dev box, I have installed mcrypt and compiled PHP with the --with-mcrypt option. I am concerned that when I move to another hosting enviornment mcrypt will not be...
1
by: Jase H | last post by:
Hello, I have a ASP.NET web application problem involving the data encryption and decryption assembly(DLL) used on the connection string value that is set in the webconfig file. The problem...
2
by: Dave Bailey | last post by:
I have developed a web app using DPAPI to encrypt a connection string in the web.config file. The application works perfectly on the development machine but when deployed to the server when...
2
by: sushant.bhatia | last post by:
Hi All. I'm using the NCrypto dll for RSA Encryption/Decryption (http://sourceforge.net/projects/ncrypto/). My encryption code in .Net is pretty simple. The dataToEncrypt length is 1024. The...
2
by: almurph | last post by:
Hi everyone, Can you help me please? I am having a problem with the encryption/decryption of words with the Irish fada in them. The Irish fada is like this: áéíóú/ÁÉÍÓÚ. It's kind of like the...
4
by: Fritjolf | last post by:
Hi. I've got a strange problem... I've made a simple program to test encryption/decryption. I use Rijndael encryption and here are the most important properties. RijndaelManaged cipher =...
3
by: =?Utf-8?B?TG9yZW4=?= | last post by:
I’m trying to encrypt and decrypt a file in vb.net. I am using the TripleDESCryptoServiceProvider encryption found in System.Security.Cryptography. Below is the code for my Encrypt and Decrypt...
5
by: Netwatcher | last post by:
well, i started messing around with dictionaries, yet, most of the pages i found about them always talk about getting only one word out of it and turning it vice versa, i've been playing with that...
9
by: Betikci Boris | last post by:
I get bored last night and wrote a script that uses xor for encrypt- decrypt, however it woks fine under linux 2.6.25, text and documents are ok, but fails on compressed files *.jpg, *.pdf , etc ....
9
by: Alan M Dunsmuir | last post by:
In my (PHP-5) application I have to write some records to a table in my database, which I don't want even my clients using the system to be able to read. This is not a problem in National...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.