vigenere

decrypt a text and find the key

Page 1 of 1

5 Replies - 4422 Views - Last Post: 04 April 2008 - 08:43 AM Rate Topic: -----

#1 becirovic  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 04-April 08

vigenere

Posted 04 April 2008 - 03:47 AM

i want to decrypt a text and also find the key using the vigenere.the key must have 4 chars
Is This A Good Question/Topic? 0
  • +

Replies To: vigenere

#2 1lacca  Icon User is offline

  • code.rascal
  • member icon

Reputation: 44
  • View blog
  • Posts: 3,822
  • Joined: 11-August 05

Re: vigenere

Posted 04 April 2008 - 04:00 AM

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: :code:

Thanks.
Was This Post Helpful? 0
  • +
  • -

#3 becirovic  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 04-April 08

Re: vigenere

Posted 04 April 2008 - 04:17 AM

private static String EncryptVigenere ( int key , String plaintext ) {
		
	if (plaintext == null) return null;
	
	String ciphertext = "";
	for (int c = 0; c < plaintext.length(); c++ ) {
		
		ciphertext += shiftChar(key , plaintext.charAt(c));
	}
	return ciphertext;



i cant find the other way.just to find the key..

i want to be returnt the key

This post has been edited by becirovic: 04 April 2008 - 04:14 AM

Was This Post Helpful? 0
  • +
  • -

#4 1lacca  Icon User is offline

  • code.rascal
  • member icon

Reputation: 44
  • View blog
  • Posts: 3,822
  • Joined: 11-August 05

Re: vigenere

Posted 04 April 2008 - 04:36 AM

I can't understand your problem. Are you looking for the decrypting function?
Was This Post Helpful? 0
  • +
  • -

#5 becirovic  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 04-April 08

Re: vigenere

Posted 04 April 2008 - 04:55 AM

View Post1lacca, on 4 Apr, 2008 - 04:36 AM, said:

I can't understand your problem. Are you looking for the decrypting function?



View Postbecirovic, on 4 Apr, 2008 - 04:51 AM, said:

View Post1lacca, on 4 Apr, 2008 - 04:36 AM, said:

I can't understand your problem. Are you looking for the decrypting function?

i have the plaintext and the ciphertext and i wnat to find the key.Can you please help me?


i have the plaintext and the ciphertext and i want to find the key.Can you please help me?
Was This Post Helpful? 0
  • +
  • -

#6 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: vigenere

Posted 04 April 2008 - 08:43 AM

You mean something like:

private static int getKey (String ciphertext  , String plaintext ) {
		
	for(int i = 0; i < 16; i++) {
				   String cipherTest = EncriptVigenere(i, plaintext);
				   if(cipherTest.equals(ciphertext))
					  return i;
	}
				// could not find the key
				return -1;
				



?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1