|
withou a full sample that exhibits the problem its hard to work out the problem.
You might want to create a new zipper object in each loop so that it starts afresh each time.
I don't use the crypto++ library at the mo as I am in a pure .NET environment.
I am using VB on the current project
www.many-monkeys.com
|
|
|
|
|
Yes, after I moved the codes in while loop to a function, it worked!
But, there has a new problem. If I just only use the UNZIP instance to unzip a data buffer zipped by ZIP in another program, each time when I run unzipper.Close(); I got an exception said: Unhandle exception in **.zip(KERNAL32.DLL):0xE06D7363: Mirosoft C++ Exception.
Why? Must I use ZIP and UNZIP together? Or I can't use UNZIP separetly?
Thank you for your kind to answer my questions!
|
|
|
|
|
you should be able to - this is one for the crypto++ people.
You could try stepping into the code and seeing where in the crypto++ code it fails exactly.
I am using VB on the current project
www.many-monkeys.com
|
|
|
|
|
Hi,
I have read many places and found that Crypto++ functions are very much compatible to php mcrypt library. I never knew how to use this in VC++ application. You have dobe such a wonderful work and its so easy to understand that i can compile and run your code easily. But i am having a small problem and hope that you can solve it out. I have to use the mcrypt library of php to encrypt a file at server and i have to decrypt the same file on client side using VC++. I am using Rijndael algorithm for encryption at server side through PHP. as the documentation says...
mcrypt's MCRYPT_RIJNDAEL_128 is compatible with cryptopp-php's CRYPTOPP_CIPHER_AES/ CRYPTOPP_CIPHER_RIJNDAEL, which are just aliases for each other.
and
MCRYPT_MODE_CBC in mcrypt and CRYPTOPP_MODE_CBC in cryptopp-php.
MCRYPT_MODE_ECB in mcrypt and CRYPTOPP_MODE_ECB in cryptopp-php.
Can you tell me how to use crypto++ to do the same. or show me some piece of code to make it easy to understand..I need it urgently..Please help in doing the same. Any help or pointers are highly appreciated.
Thanks a lot in advance..
Regards,
Himanshu
|
|
|
|
|
Your best bet is to post this to the crypto++ mailing list however as I remember there few samples in the library but the test harness they produce should give you pointers.
I currently don't use crypto++, and I don't have the latest version onmy machine.
I am using VB on the current project
www.many-monkeys.com
|
|
|
|
|
I want to know the algorithm of zipping the data and information.
I want to bild up the application like winzip or winrar.
Please tell me any logic for algorithm........
|
|
|
|
|
there are plenty of algorithms out there
I suggest you have a look at the source code for the compresion algorithm used in crypto++, you may also wish to do a search of 'zip' and 'zlib' etc on google as there are a lot of freeware (source code provided) implementations (though most algorithms of any note are patented and are protected by law)
Technically speaking the dictionary would define Visual Basic users as programmers. But here again, a very generalized, liberal definition is being employed and it's wrong - just plain wrong - Tom Archer 5/12/02
|
|
|
|
|
Hi !
I try to use your code but i can't solve this problem. I use MFC 7 .NET
I use this code.
USING_NAMESPACE( CryptoPP )
Gzip zipper; //(1) 1 is fast, 9 is slow
zipper.Put(byteOrgTest, nFileSize);
zipper.Close(); // error ?
byte* pCompressed = new byte[zipper.MaxRetrieveable()]; //error ?
zipper.Get(pCompressed,zipper.MaxRetrieveable()); //error ?
error C2039: 'Close' : is not a member of 'CryptoPP::Gzip'
error C2039: 'MaxRetrieveable' : is not a member of 'CryptoPP::Gzip'
As far as i can see Close is a member of Gzip??
Can you please help me? Why do I get this error message? 'error C2039:'
Thank's
|
|
|
|
|
Have you downloaded the latest crypto++ library from http://www.cryptoppp.com? The file on codeproject is probably a bit old.
Technically speaking the dictionary would define Visual Basic users as programmers. But here again, a very generalized, liberal definition is being employed and it's wrong - just plain wrong - Tom Archer 5/12/02
|
|
|
|
|
Yes I have downloaded the latest crypto++ "Crypto++5.1.zip" library from http://www.cryptopp.com? I downloaded it again and tryed the new software but i still got the same problem. I try to compile Dialogbased MFC project but that chould not be a problem?
|
|
|
|
|
Looked a bit further looks like they have altered the Gzip library since 4.1 to which this article was written against.
you ned to
#define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
Technically speaking the dictionary would define Visual Basic users as programmers. But here again, a very generalized, liberal definition is being employed and it's wrong - just plain wrong - Tom Archer 5/12/02
|
|
|
|
|
I inserted this first in my file #define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
but i still got the same problem?? I would wery much like to use this Gzip class
so if you can help me I would appreciate it very much.
|
|
|
|
|
well you can always use the new functions instead - for Close() its MessageEnd()
and for MaxRetrieveable() its MaxRetrievable() - they fixed the typo
I found these by searching the files
Technically speaking the dictionary would define Visual Basic users as programmers. But here again, a very generalized, liberal definition is being employed and it's wrong - just plain wrong - Tom Archer 5/12/02
|
|
|
|
|
Trying to get this thing to build in an MFC project under MSVC6? Do you think, gosh, maybe this *could* be simpler? Look no further! It's as easy as 1-2-K-aardvark-{backspace}-quark-3!
First of all, you apparently have to #define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY to even begin to get the code to compile. Then if you look in cryptlib.h, you'll see five typedef's starting at line 1555 - put a semi-colon at the end of each line, the way Kernigan intended. Honestly, the compiler can be so *picky*.
Now, assuming you said "USING_NAMESPACE(CryptoPP)" before the declaration of "zipper" - you *did* do that, didn't you? - it should compile under MSVC6. Golly, only half an hour wasted (of my time, not yours, gentle reader).
Now you can start trying to get it to link. Looks like it needs CryptLib.cpp, so add that to your project. Now you'll get "fatal error C1010: unexpected end of file while looking for precompiled header directive". Just turn off pre-compiled headers in your project's settings for now. Bloody nuisance anyway.
Now it needs GZip.cpp. Do I have to add every frigging CPP and H file to my project to get this to compile?!? I guess this isn't the elegent solution I was hoping for. But let's add all the CPP files - oops, now I get "fatal error C1076: compiler limit"! No problem, just add the compiler switch "/Zm1000" and rebuild.
Okay, now I only get 25 linker errors like "socketft.obj : error LNK2001: unresolved external symbol __imp__WSAGetOverlappedResult@20". Well, let's hunt... looks like I need to link in "Ws2_32.lib". I guess the author forgot to mention that. Just say, "#pragma comment (lib, "Ws2_32.lib")".
Yea! It links. Now lets implement decompress, and see if I get the same bytes out that I put in! It works. Now all I have to do is see if I can pare it down to under 250 CPP and H files...
Spaghetthi Rustler
|
|
|
|
|
LarryLeonard wrote:
First of all, you apparently have to #define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY to even begin to get the code to compile.
really - never had to do that myself
LarryLeonard wrote:
Now, assuming you said "USING_NAMESPACE(CryptoPP)" before the declaration of "zipper" - you *did* do that, didn't you? - it should compile under MSVC6. Golly, only half an hour wasted (of my time, not yours, gentle reader).
well you could waste a day writing it yourself and I believe we covered the namespace issue earlier
LarryLeonard wrote:
Now you can start trying to get it to link. Looks like it needs CryptLib.cpp, so add that to your project. Now you'll get "fatal error C1010: unexpected end of file while looking for precompiled header directive". Just turn off pre-compiled headers in your project's settings for now. Bloody nuisance anyway.
well that is the fault of visual studio and anybody who has used that environment soon knows about that one.
LarryLeonard wrote:
Okay, now I only get 25 linker errors like "socketft.obj : error LNK2001: unresolved external symbol __imp__WSAGetOverlappedResult@20". Well, let's hunt... looks like I need to link in "Ws2_32.lib". I guess the author forgot to mention that. Just say, "#pragma comment (lib, "Ws2_32.lib")".
errm - what sockets - I don't remember mentioning sockets.
LarryLeonard wrote:
Yea! It links. Now lets implement decompress, and see if I get the same bytes out that I put in! It works. Now all I have to do is see if I can pare it down to under 250 CPP and H files...
why - I build it as a static library then the compiler just takes what it needs when it links.
LarryLeonard wrote:
Spaghetthi Rustler
ah a cowboy - makes sense now
Technically speaking the dictionary would define Visual Basic users as programmers. But here again, a very generalized, liberal definition is being employed and it's wrong - just plain wrong - Tom Archer 5/12/02
|
|
|
|
|
Re #define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY. I wonder if we're using different versions of the code? At any rate, if you're reading this, and can't get anything to compile, try that #define - it might work.
The namespace issue was covered in someone's post. I'm just saying it would be nice if it could find its way into the article.
I understand that the pre-compiled header thing is the "fault" of Visual Studio (they'd call it a feature). I was just annoyed that instead of writing down the steps someone would need to take to get it to compile, I get to hack through it for a few hours, especially as it was billed as being "simple".
I don't remember anything about sockets, either, but if you want the thing to link, you have to include the header.
I don't *want* to build it as a static library - that may suit your purposes, but it doesn't suit mine. I posted this to help anyone else down the road in a similar boat.
Despite the tedium-induced typo, I think of the American cowboy as an honorable profession. Cowboys worked long, hard days, under little direct supervision, hewed to their own code of honor, spent years perfecting their skills, and took great pride in their work. The insulting sense of "cowboy", as a reckless hip-shooter, which you are using, is not what I meant.
|
|
|
|
|
LarryLeonard wrote:
Re #define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY. I wonder if we're using different versions of the code? At any rate, if you're reading this, and can't get anything to compile, try that #define - it might work.
we are - this article was written against 4.1 and the latest is 5.1 that define is new
LarryLeonard wrote:
I don't remember anything about sockets, either, but if you want the thing to link, you have to include the header.
well if you are going to rock the boat and not use the predefined projects that come with the library then yes you will have to build the library from scratch and that includes defing all its dependancies
LarryLeonard wrote:
I don't *want* to build it as a static library - that may suit your purposes, but it doesn't suit mine. I posted this to help anyone else down the road in a similar boat.
why? I am sorry but people do get very confused about static libraries - when you link against a static library you do *not* get the whole library linked in as well only those parts that you use so it is quite efficient. It save a lot of hassle trying to split the files apart and you have the advantage that if you want to use something else from the library it's already to hand.
Technically speaking the dictionary would define Visual Basic users as programmers. But here again, a very generalized, liberal definition is being employed and it's wrong - just plain wrong - Tom Archer 5/12/02
|
|
|
|
|
Geez, in those 279 files in the ZIP file, I didn't even *see* the two DSP files. You might want to mention their existance in your article - who knew they were even there?? This is what I'm talking about: just a little more detail in your article would make it 100 times more useful.
(And yes, some people do get confused by statically linked libraries. I fully understand them, and have written and used them for over a decade, but in this case, they simply do not fit my purpose: I don't *want* to link against a static library. It's not an efficiency issue. I'm sure other people might find themselves in a similar situation someday.)
|
|
|
|
|
Doesn't compile in Visual C++ 7.0
|
|
|
|
|
you may need to get the latest library from www.cryptocpp.com[^]
Technically speaking the dictionary would define Visual Basic users as programmers. But here again, a very generalized, liberal definition is being employed and it's wrong - just plain wrong - Tom Archer 5/12/02
|
|
|
|
|
hi, im having trouble using this library...
im uing M VC++ 6.0 on Win 98,
can any one provide me step by step instructions to use this library
Thanx
|
|
|
|
|
what problems are you having?
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
Well, if i am to use this library in my work space in a dialog based application to zip and unzip a file
how would i accomplish this.
I've tried to follow the readme file but that doesnt work...
|
|
|
|
|
if you are on about .zip files then I don't think it will work - as a .zip file isn't just one compressed file but many files bundled together - you will have to look at the .zip file spec for that
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
hi ,
I've tested your code , but the return pointer contains nothing . if i save returned buffer to file the file size would be 0 , why ?
B.Regards
|
|
|
|