cryptography

cryptography

Hi... does anybody send me the code for encrypt and decrypt a file using caesar cipher and transposition cipher, substitution cdipher in single program... How to combine these 3 ciphers in a single program............. pls send me guys..

View Answers

November 10, 2012 at 12:44 PM

Here is a code of encryption and decryption string.Similarly you can encrypt and decrypt the file data.

import java.security.*; 
import javax.crypto.*;
import javax.crypto.spec.DESKeySpec;

class EncryptAndDecrypt {

public static void main (String[] args) throws Exception{ 
    SecretKeyFactory key = SecretKeyFactory.getInstance("DES");
    SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN");

    byte[] desKeyData = { (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06, (byte)0x07, (byte)0x08 }; 
    DESKeySpec desKeySpec = new DESKeySpec(desKeyData);

    Key keys = key.generateSecret(desKeySpec);
    Cipher cipher = Cipher.getInstance("DES");
    cipher.init(Cipher.ENCRYPT_MODE, keys);
    String st= "Welcome";
    byte[] cleartext = null;
    cleartext = st.getBytes();
    byte[] ciphertext = null;
    ciphertext = cipher.doFinal(cleartext); 
    System.out.println("the encrypted text is: " + ciphertext.toString());

    cipher.init(Cipher.DECRYPT_MODE, keys); 
    byte[] cleartext1 = cipher.doFinal(ciphertext);
    System.out.println("the decrypted cleartext is: " + new String(cleartext1));
    }
}









Related Tutorials/Questions & Answers:
cryptography - Security
cryptography  What is cryptography
Cryptography
Advertisements
cryptography
JAVA Cryptography
JAVA Cryptography   Hey Guys am new in here so take it easy on me ... i wanna ask you about java import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; /** * Basic symmetric encryption example */ public class
JAVA Cryptography
JAVA Cryptography   Hey Guys am new in here so take it easy on me ... i wanna ask you about java import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; /** * Basic symmetric encryption example */ public class
ModuleNotFoundError: No module named 'cryptography'
ModuleNotFoundError: No module named 'cryptography'  Hi, My Python... 'cryptography' How to remove the ModuleNotFoundError: No module named 'cryptography' error? Thanks   Hi, In your python
visual cryptography - Java Beginners
visual cryptography  iam doing M.E cse iam undergoing project phase doing project in Halftone visual cryptography may i know how to convert the single image into 2 shares by encoging in java
ModuleNotFoundError: No module named 'django-cryptography'
ModuleNotFoundError: No module named 'django-cryptography'  Hi, My... named 'django-cryptography' How to remove the ModuleNotFoundError: No module named 'django-cryptography' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-cryptography'
ModuleNotFoundError: No module named 'django-cryptography'  Hi, My... named 'django-cryptography' How to remove the ModuleNotFoundError: No module named 'django-cryptography' error? Thanks   Hi
ModuleNotFoundError: No module named 'sdc-cryptography'
ModuleNotFoundError: No module named 'sdc-cryptography'  Hi, My... named 'sdc-cryptography' How to remove the ModuleNotFoundError: No module named 'sdc-cryptography' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'cryptography-vectors'
ModuleNotFoundError: No module named 'cryptography-vectors'  Hi...: No module named 'cryptography-vectors' How to remove the ModuleNotFoundError: No module named 'cryptography-vectors' error? Thanks   Hi
ModuleNotFoundError: No module named 'cryptography-with-deps'
ModuleNotFoundError: No module named 'cryptography-with-deps'  Hi...: No module named 'cryptography-with-deps' How to remove the ModuleNotFoundError: No module named 'cryptography-with-deps' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-cryptography'
ModuleNotFoundError: No module named 'django-cryptography'  Hi, My... named 'django-cryptography' How to remove the ModuleNotFoundError: No module named 'django-cryptography' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-encrypted-id-cryptography'
ModuleNotFoundError: No module named 'django-encrypted-id-cryptography' ...: ModuleNotFoundError: No module named 'django-encrypted-id-cryptography' How to remove the ModuleNotFoundError: No module named 'django-encrypted-id-cryptography'
ModuleNotFoundError: No module named 'django-encrypted-id-cryptography'
ModuleNotFoundError: No module named 'django-encrypted-id-cryptography' ...: ModuleNotFoundError: No module named 'django-encrypted-id-cryptography' How to remove the ModuleNotFoundError: No module named 'django-encrypted-id-cryptography'
ModuleNotFoundError: No module named 'django-encrypted-id-cryptography'
ModuleNotFoundError: No module named 'django-encrypted-id-cryptography' ...: ModuleNotFoundError: No module named 'django-encrypted-id-cryptography' How to remove the ModuleNotFoundError: No module named 'django-encrypted-id-cryptography'
ModuleNotFoundError: No module named 'django-field-cryptography'
ModuleNotFoundError: No module named 'django-field-cryptography'  Hi...: No module named 'django-field-cryptography' How to remove the ModuleNotFoundError: No module named 'django-field-cryptography' error? Thanks  
a competitive study on cryptography techniques over block cipher
a competitive study on cryptography techniques over block cipher  i need "a competitive study on cryptography techniques over block cipher" project source code... plz reply to my post... for more information about this project
parallel cryptography
Java cryptography - Java Beginners
Java Security
) In this tutorial, the author explains the cryptography-related concepts... learnt will be useful in understanding the Cryptography API in MFC also...; JCA/JCE (Java Cryptography Architecture & Java Cryptography Extensions
Java One way Hashing
Java One way Hashing One way hash functions are a major tool in cryptography. It is used to create digital signatures, which in turn identify and authenticate the message. It can have other practical applications as well
PHP Random Number
PHP Generate Random Numbers: A random number is becoming more useful these days, like captcha, statistical sampling, cryptography, computer simulation etc. To generate random number, PHP provides rand() function. 
Hi friends
Hi friends  How to create a guy based application for cryptography(encryption and decryption) with multiple algorithms like caesar, hash ..etc
Regarding project - Applet
Regarding project  hi friend , iam doing project in Visual cryptography in Java so i need the Help regarding how to make a share of a original imahe into shares anu
how to produce halftone shares? - Java Beginners
the original image.  Hi friend, Visual cryptography encodes a secret... to achieve a higher level of security, halftone visual cryptography was proposed
What is WTLS?
What is WTLS?  hii, What is WTLS?   hello,ADS_TO_REPLACE_1 Wireless Transport Layer Security protocal (WTLS) does all cryptography oriented features of WAP. WTLS handles encryption/decryption, user authentication
Help needed for J2me and PHP - Development process
Help needed for J2me and PHP  Hello Sir I am a degree student. I have a small CRM application using J2me and PHP. I want to do cryptography using bouncy castle and decrypt the same in php with mcrypt extension. I did try
Who invented Blockchain technology
uses cryptography for the data into Ledger. Data stored in Ledger... discussed this technology to save digital record using cryptography with timestamp
What is blockchain technology
is a technology which uses cryptography and other IT technologies to store data
What is blockchain technology
is a technology which uses cryptography and other IT technologies to store data
What is blockchain technology
is a technology which uses cryptography and other IT technologies to store data
library
(); Course c1 = new Course("Cryptography"); Course c2 = new Course("Java
What is Blockchain?
. This technology of tamper-proof data block is achieved through cryptography. The contents... summarize it as the decentralized, consensus-driven, immutable, cryptography
What is Blockchain?
_TO_REPLACE_1 This technology of tamper-proof data block is achieved through cryptography..., cryptography-protected, publicly accessible transaction ledger which
Other Base Packages
control, digital signing, cryptography. Internationalization
Java SE 7
: Elliptic Curve Cryptography (ECC), CertPath Algorithm Disabling  etc Swing
Generate random numbers in Java
in cryptography environment then its instance is cryptographically insecure. This class
Blockchain Tutorial
of Blockchain technology. To work with the cryptography and cryptocurrency
Blockchain Tutorial
of Blockchain technology. To work with the cryptography and cryptocurrency
Blockchain Tutorial
of Blockchain technology. To work with the cryptography and cryptocurrency
What are New Features in JAVA SE 6
of security APIs. These Security APIs span a wide range of areas, including cryptography
What is Applet in Java with Example?
including animation applets. Applet program can be signed with the cryptography
Blockchain Tutorial
with the cryptography and cryptocurrency technologies of Blockchain To work
New Features of JAVA SE 6.
of areas, including cryptography public key infrastructure, secure communication
SQUANDER CRPTOGRAPHY
", Lord Peter Wimsey describes a cryptography technique that is simple for encoding... together in a pair, so where that happens, we shove in a Q, which won't confuse... letter at the end, we'd add on another Q to square it up. Now we take our first
SQUANDER CRPTOGRAPHY
", Lord Peter Wimsey describes a cryptography technique that is simple for encoding... together in a pair, so where that happens, we shove in a Q, which won't confuse... letter at the end, we'd add on another Q to square it up. Now we take our first
what is the difference between jdk 1.4 and 1.5 and 1.6
and XSLT processor (JAXP) - Integrated security and cryptography extensions (JCE
plsz i want the coding details of line
this code....its come visual cryptography grayconversion coding plsz anybody
plsz i want the coding details of line
get this value... plsz explain this code....its come visual cryptography

Ads