Skip to content

ajrajput-04/string-encryption-and-decryption-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

string-encryption-and-decryption-

java program file to encrypt plain text and decrypt back to the plain text

PACKAGES AND CLASSES USED Cipher: Core class for encryption/decryption. KeyGenerator: Used to generate a secret AES key. SecretKey: Represents the AES key. Base64: Encodes/decodes binary data to/from readable strings. Scanner: Reads user input from the console.

ENCRYPTION METHOD Cipher.getInstance("AES"): Creates a cipher object for AES. cipher.init(...): Initializes it for encryption using the secret key. doFinal(...): Encrypts the input string (converted to bytes). Base64.encodeToString(...): Converts encrypted bytes to a readable string.

DECRYPTION METHOD Similar to encryption, but uses DECRYPT_MODE. Decodes the Base64 string back to bytes. Decrypts the bytes and converts them back to the original string.

SCANNER AND KEY SETUP Scanner: Reads user input. KeyGenerator: Creates a new AES key. init(128): Sets key size to 128 bits. generateKey(): Produces the secret key used for encryption/decryption.

About

java program file to encrypt plain text and decrypt back to the plain text

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published