Simple AES
-
I have a question that is think should be rather simple, I also feel it is not a copy of a question from years back. I am new to programing in general and I have only been doing it on and off for a few years. I use the VS2012 compiler & GNU GCC with C & C++. My question is really simple and I will try to explain this so everyone can understand. I want to make two functions that can encrypt or decrypt strings using AES or rinjdael. http://pastebin.com/Gw0RLBNR[^] The paste above is what I am talking about, it uses two functions one teaEncode and one teaDecode. I want to figure out how to make an equivalent to the tea system above but with AES. https://github.com/seonggwang/miniature-AES[^] Now I understand some of you would link me to like the one below. WinAES: A C++ AES Class[^] I'll be blunt I have been trying to make a function to encrypt/decrypt data in C++ under VS2012 using many different page on git. But the problem is few of them want to compile and I really don't know how to fix many of the issue they bring up. So I really am just asking for a AES string encryption/decryption that works under VS2012 or GCC.
-
I have a question that is think should be rather simple, I also feel it is not a copy of a question from years back. I am new to programing in general and I have only been doing it on and off for a few years. I use the VS2012 compiler & GNU GCC with C & C++. My question is really simple and I will try to explain this so everyone can understand. I want to make two functions that can encrypt or decrypt strings using AES or rinjdael. http://pastebin.com/Gw0RLBNR[^] The paste above is what I am talking about, it uses two functions one teaEncode and one teaDecode. I want to figure out how to make an equivalent to the tea system above but with AES. https://github.com/seonggwang/miniature-AES[^] Now I understand some of you would link me to like the one below. WinAES: A C++ AES Class[^] I'll be blunt I have been trying to make a function to encrypt/decrypt data in C++ under VS2012 using many different page on git. But the problem is few of them want to compile and I really don't know how to fix many of the issue they bring up. So I really am just asking for a AES string encryption/decryption that works under VS2012 or GCC.
If you can't use one of the few that compile, try listing the specific compilation errors for one that does not. People here are willing to help with specific issues.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
-
If you can't use one of the few that compile, try listing the specific compilation errors for one that does not. People here are willing to help with specific issues.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
I've had problems with a few different interpretations. I don't understand the this one. A Fast and Easy to Use AES Library[^] It does some crazy stuff with int32. I have however tried using crypt CPP with code sourced from this website. http://www.mediafire.com/download/kls7loakmidciqt/AES.zip[^] That link contains the source information and the errors under vs2012.
-
I've had problems with a few different interpretations. I don't understand the this one. A Fast and Easy to Use AES Library[^] It does some crazy stuff with int32. I have however tried using crypt CPP with code sourced from this website. http://www.mediafire.com/download/kls7loakmidciqt/AES.zip[^] That link contains the source information and the errors under vs2012.
The error messages tell you what to do. What are you having trouble with? None of your 3 invocations of cl include the switch specified in the error messages (/EHsc) Likewise, did you make the suggested change to line 28 of aes.cpp?
"When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon
-
The error messages tell you what to do. What are you having trouble with? None of your 3 invocations of cl include the switch specified in the error messages (/EHsc) Likewise, did you make the suggested change to line 28 of aes.cpp?
"When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon
I am having problems with fixing the errors.
-
I am having problems with fixing the errors.
Er, yes. You ah, you already made that clear in your first post. What specifically is giving you a problem?
"When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon
-
Er, yes. You ah, you already made that clear in your first post. What specifically is giving you a problem?
"When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon
That error I am not sure how to fix it and I am pretty sure more errors will come up after it. I did attach a file with the error log in it.
-
That error I am not sure how to fix it and I am pretty sure more errors will come up after it. I did attach a file with the error log in it.
There is one error and one warning shown there. The solution to each are in the messages! 1. Warning - arising from one of the VS supplied files. 2. Error - the compiler isn't prepared to treat a
const char*
as aconst byte*
To solve, follow the directions. I.e 1. Add the /EHsc switch to the command line. - "cl /EHsc aes.cpp" 2. Goto line 29 of aes.cpp and cast the first parameter of DefaultEncryptorWithMAC to be aconst byte*
Something like:DefaultEncryptorWithMAC( (const byte*)firstParam, secondParam, thirdParam);
"When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon
-
There is one error and one warning shown there. The solution to each are in the messages! 1. Warning - arising from one of the VS supplied files. 2. Error - the compiler isn't prepared to treat a
const char*
as aconst byte*
To solve, follow the directions. I.e 1. Add the /EHsc switch to the command line. - "cl /EHsc aes.cpp" 2. Goto line 29 of aes.cpp and cast the first parameter of DefaultEncryptorWithMAC to be aconst byte*
Something like:DefaultEncryptorWithMAC( (const byte*)firstParam, secondParam, thirdParam);
"When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon
http://www.codeproject.com/script/Articles/ViewDownloads.aspx?aid=21877[^] Well thanks but both corrections seem to be fruitless. If it is in anyway helpful here is a direct link to the original code. http://www.codeproject.com/script/Articles/ViewDownloads.aspx?aid=21877[^]
-
http://www.codeproject.com/script/Articles/ViewDownloads.aspx?aid=21877[^] Well thanks but both corrections seem to be fruitless. If it is in anyway helpful here is a direct link to the original code. http://www.codeproject.com/script/Articles/ViewDownloads.aspx?aid=21877[^]
Bother. :( I'd actually downloaded the project yesterday that you shared at MediaFire or wherever it was. I've just tried the page you linked to here, but only saw the ability to browse 10 sample projects. Going back to the article's main page also only gives the ability to download any one of the 10 samples. So, I gave it a go and carried-on anyway - loading the SLN file in your zip.I converted it to one that VS2010 was happy with and hit build. Great, no problem - it builds just fine. -- Next, I created a new win32, console project in the solution.(called Member10657083) I copied the contents of your aes.cpp file and replaced the contents of "Member10657083.cpp" with it. I also uncommented the #include stdafx.h line. Upon trying to build, I didn't get that warning you had, but still got the same error. Mistakenly, I changed
new DefaultEncryptorWithMAC( password.c\_str(),
into
new DefaultEncryptorWithMAC( (const char\*)password.c\_str(),
Of course, the error was exactly the same. Realizing my mistake, I then changed it to:
new DefaultEncryptorWithMAC( (const byte\*)password.c\_str(),
and tried again. Bingo! The project compiled. While the project didn't successfully build, it was only linker errors, since I didn't add any to the new project. I'm tired and very rarely use VS, so I'm not going to tackle that tonight. Hope this helps. :) Let me know how you get on.
"When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon
-
Bother. :( I'd actually downloaded the project yesterday that you shared at MediaFire or wherever it was. I've just tried the page you linked to here, but only saw the ability to browse 10 sample projects. Going back to the article's main page also only gives the ability to download any one of the 10 samples. So, I gave it a go and carried-on anyway - loading the SLN file in your zip.I converted it to one that VS2010 was happy with and hit build. Great, no problem - it builds just fine. -- Next, I created a new win32, console project in the solution.(called Member10657083) I copied the contents of your aes.cpp file and replaced the contents of "Member10657083.cpp" with it. I also uncommented the #include stdafx.h line. Upon trying to build, I didn't get that warning you had, but still got the same error. Mistakenly, I changed
new DefaultEncryptorWithMAC( password.c\_str(),
into
new DefaultEncryptorWithMAC( (const char\*)password.c\_str(),
Of course, the error was exactly the same. Realizing my mistake, I then changed it to:
new DefaultEncryptorWithMAC( (const byte\*)password.c\_str(),
and tried again. Bingo! The project compiled. While the project didn't successfully build, it was only linker errors, since I didn't add any to the new project. I'm tired and very rarely use VS, so I'm not going to tackle that tonight. Hope this helps. :) Let me know how you get on.
"When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon
That did change things but it seems to have created quite a few linker errors on my end as well.