Hi cryptographers,
I'm currently working on AES.I have got codes for Encryption and Decryption separeately.But my problem is that i want to use a single function that is able to do encryption and decryption.If any codes available,please send it.

I know two verses of a song (in a function), but I need someone (another function), to tell me which one to start singing.

How could that be done?

Have you ever heard of PARAMETER City? Lovely place. Post up your map and bring your compass, and we'll get you there.

if(you want to visit the museum) (parameter type is 1, so encrypt)
  arrive on a Saturday (encrypt)
else
  arrive on a Monday for best room rates (decrypt)

I love the travel industry. ;)

Have u gone through AES Fips197 document,there is a concept called EquivalentInverse cipher any idea of how to use in program?

I believe you are laboring under a very poor concept here. You do NOT NOT NOT want to mess with the "inner" workings of a proven cryptology program.

It works -- leave it alone.;)

Treat each part of it (encryption and decryption), as "black boxes", and code up function logic around them (like a wrapper around a sandwich - it doesn't disturb the contents of the sandwich in any way).

The NIST studied several candidates for their new crypto program, and have put a lot of info on their relative performance, into a PDF you can download from their website.

With that in mind, I don't see your problem: you have the code you need for the crypto program, except how you want to combine the two functions, into one.

I answered that question: you use a parameter value that you will pass when you call the crypto function. That will decide whether the text you're also passing (or file), will be encrypted, or decrypted.

Good crypto programs are fine pieces of logic, and have to be extensively (very extensively) worked out by the creators, and tested. If you change just one piece of the "inner" logic, you may easily ruin it, AND you probably won't know it without a huge amount of testing, by experts in the field.

In conclusion, don't mess with the inner workings of the crypto program. Use it, and make any "wrapper" type handling function for it, that you need. If you want to compare crypto programs, check what the NIST has, for starters, and match the program you need, to the level of security and convenience, you need.

Thank you man for sharing your knowledge with me.Well to tell you the fact i'am really a newbie with AES.I do not have much of programming knowledge to code myself and due to time constraints i have to really work fast inorder to comnplete my project.I have got separate programs for en/decrypt.But my task is to use Equivalent Inverse Cipher.
If you coded any AES algos share it with me......

commented: I don't know about your mother language but in English there's a period AND SPACE at the end of sentences. The written word is NOT an web address. -3

I have not used the AES cryptology program.

Maybe you are not a game lover. But you must know the game aion kinah. Some people would choose to buy WOW Gold online as a result of cheap wow gold price. Sparing some time to play game is a good way to relax yourself. If you are interested in the game, choose more WOW Gold to make your role stronger.

what u mean?????

Do u know how declare this
while (i < Nk)
w = word[ key[4*i], key[4*i+1], key[4*i+2], key[4*i+3] ]
i = i + 1

Actullly i have using simple assignment.now i want above one.

For encrypting, N would be a number that was defined or declared a const, earlier in the program. K I'm not sure of, but I'll hazard a guess it's a prime number chosen by the algorithm, on this run. Might be a hash value, also.

Key[] is the index array used to help encode (along with i and some simple arithmetic), the plain text (word[]), into encrypted text - which is being put into the array w[].

You need a bit more info on N and k, and on the values put into key[], before this while loop started.

What algorithm is this taken from?

This is not difficult code, but you need a bit more info to do it as it was intended to be done.

thanks man u r really solving my threads expect a lot from you....well as said this code is for AES key expansion.Acoording to fips197 the w is an array of bytes where words a stored in a column fashion(i.e. asingle row).I have using like this
for(i=0;i<Nr<i++)
{
Roundkey[i*4]=Key[i*4];
Roundkey[i*4+1]=Key[i*4+1];Roundkey[i*4+2]=Key[i*4+2];Roundkey[i*4+3]=Key[i*4+3];}
i want to replace this by w = word[ key[4*i], key[4*i+1], key[4*i+2], key[4*i+3] ]
But i not able to get it....

Well, I didn't know what the "AES" was, and now I've discovered "AES" is the Rajindal algorithm. I knew it as that before it was accepted by NIST, and became the new AES.

So, back to your problem. You're going about this the wrong way, my friend. You don't want to "roll your own" encryption algorithm, even if you have a certain pattern or knowledge about it. Even the pro's make mistakes designing their algorithms, and they're made useless by some attack or other.

The code you posted is just one part of an AES program. There is much more to it than this one for loop you have posted. Way more.

If you want to "roll your own" crypto program, I suggest "CipherSaber"
http://ciphersaber.gurus.org/

Which is vastly easier to program. Designed actually, to be easily remembered and mastered. No, it's not as good as AES, and for constant use, I don't even believe it's practical, because it has no way to use public keys readily.

If you want a stronger crypto algorithm, then find one of the posted AES programs, and copy and paste it.

Because what you have for code, is almost nothing, and these programs run into a few pages once you get some decent features into them. It's not easy code to write or understand, and they're a horror (of course), to debug. There's nothing here for the beginning student to easily work with.

I don't like splashing cold water onto your project, but there's just no chance that it's going to succeed this way. I was looking at a TwoFish program yesterday (TwoFish is very similar to AES), and to put it mildly, you do NOT want to go there with anything less than strong programming skills AND an excellent understanding of what the AES algorithm is doing, every step of the way.

Find yourself an AES C program, and see if you don't agree. Then copy and paste it. ;)

hey i have been just doing copy paste thing for my project....
I know all the underlying concept AES,but the problem lies in programming.....actually i had doubt on that part which i had posted earlier...If this get solve then things are quite straight for me...
Well my task is to build AES using Equivalent Inverse Cipher

I did some Googling, and there are some links to AES and Equivalent Inverse Cipher, but I haven't found anything that has a simple example or description of it.

It's all in Crypto-speak, so far! ;)

What have you found?

Man,quite really hard for me ..Well i googled a lot all in vain...If possible can u read FIPS-197 pg29 which says about Equivalent Inverse Cipher...
And also is it possible to implement a program as like the psuedocode given???

I have also Googled quite a bit, (8 pages of links), and have not found code in C showing the EIC.

What might be possible to code from given pseudo code? Depends who's doing the coding, and whether they were familiar with the logic of that pseudo code.

Which leads me to recommending that you direct your questions in this general cryptographic area, to forums that focus on cryptology, like sci.crypt on Usenet (also available through Google groups I believe). What you want isn't just C, and it isn't just simple cipher help (Playfair, Vignere, etc.). It's complex, detailed, and you want a particular flavor of a particular cipher, coded up.

That is just not going to happen in a C forum, imo.

Google up some other forums, and see if your questions can be given some better answers. It's just not C-focused, enough to get members involved on this forum.

I have also Googled quite a bit, (8 pages of links), and have not found code in C showing the EIC.

What might be possible to code from given pseudo code? Depends who's doing the coding, and whether they were familiar with the logic of that pseudo code.

Which leads me to recommending that you direct your questions in this general cryptographic area, to forums that focus on cryptology, like sci.crypt on Usenet (also available through Google groups I believe). What you want isn't just C, and it isn't just simple cipher help (Playfair, Vignere, etc.). It's complex, detailed, and you want a particular flavor of a particular cipher, coded up.

That is just not going to happen in a C forum, imo.

Google up some other forums, and see if your questions can be given some better answers. It's just not C-focused, enough to get members involved on this forum.

hi got any stuff regarding EIC.....Shall i post my code...Man i'm going nuts with this ...Please

No. As stated previously, I looked through 8 pages of results on Google for this, and none of them had what you needed.

Did you try sci.crypt on Usenet yet? Have you tried taking the description of EIC, and coding it up from there?

That and more looking on the net, is all I can advise. Be persistent!

I have also Googled quite a bit, (8 pages of links), and have not found code in C showing the EIC.

What might be possible to code from given pseudo code? Depends who's doing the coding, and whether they were familiar with the logic of that pseudo code.

Which leads me to recommending that you direct your questions in this general cryptographic area, to forums that focus on cryptology, like sci.crypt on Usenet (also available through Google groups I believe). What you want isn't just C, and it isn't just simple cipher help (Playfair, Vignere, etc.). It's complex, detailed, and you want a particular flavor of a particular cipher, coded up.

That is just not going to happen in a C forum, imo.

Google up some other forums, and see if your questions can be given some better answers. It's just not C-focused, enough to get members involved on this forum.

hi got any stuff regarding EIC.....Shall i post my code...Man i'm going nuts with this ...Please

I have also Googled quite a bit, (8 pages of links), and have not found code in C showing the EIC.

What might be possible to code from given pseudo code? Depends who's doing the coding, and whether they were familiar with the logic of that pseudo code.

Which leads me to recommending that you direct your questions in this general cryptographic area, to forums that focus on cryptology, like sci.crypt on Usenet (also available through Google groups I believe). What you want isn't just C, and it isn't just simple cipher help (Playfair, Vignere, etc.). It's complex, detailed, and you want a particular flavor of a particular cipher, coded up.

That is just not going to happen in a C forum, imo.

Google up some other forums, and see if your questions can be given some better answers. It's just not C-focused, enough to get members involved on this forum.

hi got any stuff regarding EIC.....Shall i post my code...Man i'm going nuts with this ...Please

No. As stated previously, I looked through 8 pages of results on Google for this, and none of them had what you needed.

Did you try sci.crypt on Usenet yet? Have you tried taking the description of EIC, and coding it up from there?

That and more looking on the net, is all I can advise. Be persistent!

Yup! i asked about EIC in sci.crypt but not got any answers till now....
Well i have a decryption program which is built in reference of AES pseudo Code..
I also made some changes but not getting results...

And send me the links which you had googled i mean those 8 pages...

At first I was going to post up my own AES code when I had the time, but after the constant bumping with zero-value posts and duplicate threads, I think I'll just let you figure it out on your own. Nice job.

You're such a tease, Narue! ;)

http://www.cs.utsa.edu/~wagner/laws/AESDec.html

The link above, has C like code for EIC. The Green colored link at the top of the page, (to the book), allows a download of the entire book "Handbook of Applied Cryptology", in separate chapters. I haven't read the book yet, but it could help you with any background info you need on Cryptology.

So asking in sci.crypt on Usenet was helpful. ;)

You're such a tease, Narue!

Yup. But seriously, by now he could easily have derived code from the pseudocode in the AES specification. It's a complex algorithm, but all of the pieces are handed to you along with instructions for putting them together.

Yup. But seriously, by now he could easily have derived code from the pseudocode in the AES specification. It's a complex algorithm, but all of the pieces are handed to you along with instructions for putting them together.

Dear Naure..
We are here to help the people from problem...And I say you truly that i'm just a beginner and very new to the world of cryptology...I have trying a lot to work with psuedocode but it didnt much help me out...and also i'm reallly a bad programmer..

Well it been a month i have been working on EIC and not able to figure out.....Through googling i found decryption code and tried on it implement Eic but all in vain....'


Man if u have the code just post..Ther's no harm..u have my word

You're such a tease, Narue! ;)

http://www.cs.utsa.edu/~wagner/laws/AESDec.html

The link above, has C like code for EIC. The Green colored link at the top of the page, (to the book), allows a download of the entire book "Handbook of Applied Cryptology", in separate chapters. I haven't read the book yet, but it could help you with any background info you need on Cryptology.

So asking in sci.crypt on Usenet was helpful. ;)

Hi,
thanks for the link i went through that but it does not solve may problem..In aes decryption there is transformation which is totally different from encryption...So if we implement using Equivalent Inverse Cipher the transformation are same as that of encryption and thers a change in key schedule..I bet if you take a little time you will surely crack it...

Well it been a month i have been working on EIC and not able to figure out.....

What have you tried? All I've seen is you begging for code; nothing to show you've put any effort into your own implementation. If you're such a beginner that it's impossible given very specific instructions (provided in the AES spec), perhaps you should start with less overwhelming algorithms.

I ask this: if I give you my code, what do you learn? And why are you so bent out of shape over the equivalent inverse cipher anyway? Is it a homework requirement or something?

What have you tried? All I've seen is you begging for code; nothing to show you've put any effort into your own implementation. If you're such a beginner that it's impossible given very specific instructions (provided in the AES spec), perhaps you should start with less overwhelming algorithms.

I ask this: if I give you my code, what do you learn? And why are you so bent out of shape over the equivalent inverse cipher anyway? Is it a homework requirement or something?

Well man,i'm really much depressed with my work....Actually yup it's a homework given to me...But i failed to prove my capabilty..Thats the reason I'm begging for codes....
actually i'm a student doing training so my guide wanted me implement decryption of aes in equivalent inverse cipher mode..i had a decryption code and tried to modified it according to psuedocode but all in vain and also i'm able to get much of it...as i said i have totally no idea of cryptography and also i'm not a good programmer...thats the reason i'm was asking for codes....theres no other motives....trust me...and moreover if ever you change your mind and wish to post your code i'll just take it as a reference...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.