Click here to Skip to main content
14,836,883 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi, I'm trying to encrypt a a given text using AES,
the text is

joy leap joy skip joy dance
joy in brevity of life lives
joy in brevity life celebration
joy in a moment pace lives

I need to make this a single string, store them in a char array[16] and encrypt.

Can anyone suggest how to do it?

1 solution

You can't.
The text you show contains 112 characters: you cannot fit that into 16 characters without throwing away information - which would render the decryption useless!
Comments 20-Apr-14 11:35am
that is where I need a guidance actually. I need to encrypt this whole text. I'm using AES where my key is 16 bytes. So how will I encrypt and decrypt the above mentioned poem. If you have any suggestion can you please guide.
Thanks for you time. :)
OriginalGriff 20-Apr-14 11:50am
The Key is not the text to encrypt! It's the sequence of characters that allows you to decrypt the text - the password if you like - you provide it and the original data to encrypt, and it and the encrypted version to decrypt.

Have a look at the MSDN documentation for AES encryption - shows an example:
But I prefer the DES version:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900