Click here to Skip to main content
15,921,179 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: A fatal error while compiling Pin
ILoveCS3-Sep-05 3:19
ILoveCS3-Sep-05 3:19 
QuestionHow to make excel addin in vc++ Pin
bhanu pratap2-Sep-05 19:09
bhanu pratap2-Sep-05 19:09 
AnswerRe: How to make excel addin in vc++ Pin
ThatsAlok2-Sep-05 20:55
ThatsAlok2-Sep-05 20:55 
QuestionVC++ Using Blowfish Compiler Error Pin
CooperWu2-Sep-05 16:04
CooperWu2-Sep-05 16:04 
GeneralRe: VC++ Using Blowfish Compiler Error Pin
sunit52-Sep-05 21:10
sunit52-Sep-05 21:10 
GeneralRe: VC++ Using Blowfish Compiler Error Pin
CooperWu3-Sep-05 2:49
CooperWu3-Sep-05 2:49 
AnswerRe: VC++ Using Blowfish Compiler Error Pin
CooperWu3-Sep-05 2:59
CooperWu3-Sep-05 2:59 
Questiona blowfish decrypt/encrypt related question Pin
Torune2-Sep-05 16:03
Torune2-Sep-05 16:03 
hi guys,
currently i am working on a server/client which uses blowfish to encrypt/decrypt the message protocal.
the problem i am facing is i was trying to implement the blowfish that George Anescu provided at (http://www.codeproject.com/cpp/blowfish.asp)

but the result doesn't looks right.
encrypted
0xEA,0xC4,0x60,0x77,
0x14,0x6A,0xBC,0x23,
0x3B,0x36,0xFC,0x34,
0xA0,0xDD,0x82,0xAF,
0xD6,0x9E,0xAB,0x38,
0x05,0xB1,0xE6,0x98,
0x0D,0x2D,0x41,0x44,
0x78,0x22,0x29,0xB6,
0x76,0x62,0x4A,0x79,
0xFE,0x01,0xED,0x06,
0x51,0xE7,0x19,0xE1,
0x35,0x1E,0xAA,0x19
should be decrypted to something like this
0x00,0x74,0x6f,0x72,
0x75,0x6e,0x65,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x63,
0x68,0x65,0x6e,0x77,
0x65,0x69,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x08,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x78,0x16,0x64,0x6e,
0x00,0x00,0x00,0x00
with the encrypt key: [;'.]94-31==-%&@!^+]\0

I have no idea why its wrong.
my test code is following

Blowfish.h
Blowfish.cpp
you can get them at http://www.codeproject.com/cpp/blowfish.asp
<br />
#include <iostream><br />
#include <fstream><br />
#include "Blowfish.h"<br />
<br />
using namespace std;<br />
<br />
void main()<br />
{<br />
	//TESTING Blowfish<br />
	try<br />
	{<br />
		ofstream out("out.txt", ios::trunc);<br />
		char ENCRYPTKEY[] = "[;'.]94-31==-%&@!^+]";<br />
		unsigned char decrypted[] = {<br />
		0x00,0x74,0x6f,0x72,0x75,0x6e,0x65,0x00,<br />
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,<br />
		0x68,0x65,0x6e,0x77,0x65,0x69,0x00,0x00,<br />
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,<br />
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,<br />
		0x78,0x16,0x64,0x6e,0x00,0x00,0x00,0x00<br />
		};<br />
		<br />
		unsigned char encrypted[] = {	<br />
		0xEA,0xC4,0x60,0x77,0x14,0x6A,0xBC,0x23,<br />
		0x3B,0x36,0xFC,0x34,0xA0,0xDD,0x82,0xAF,<br />
		0xD6,0x9E,0xAB,0x38,0x05,0xB1,0xE6,0x98,<br />
		0x0D,0x2D,0x41,0x44,0x78,0x22,0x29,0xB6,<br />
		0x76,0x62,0x4A,0x79,0xFE,0x01,0xED,0x06,<br />
		0x51,0xE7,0x19,0xE1,0x35,0x1E,0xAA,0x19<br />
		};<br />
		unsigned char szDataOut[48];<br />
		CBlowFish oBlowFish((unsigned char*)ENCRYPTKEY, sizeof(ENCRYPTKEY));<br />
		//Test ECB<br />
		oBlowFish.Encrypt(decrypted, (unsigned char*)szDataOut, sizeof(decrypted), CBlowFish::ECB);<br />
		out <<szDataOut<<endl;<br />
		<br />
		memset(szDataOut,0,sizeof(szDataOut));<br />
		oBlowFish.Decrypt(encrypted, (unsigned char*)szDataOut, sizeof(encrypted), CBlowFish::ECB);<br />
		out <<szDataOut<<endl;<br />
	}<br />
	catch(exception& roException)<br />
	{<br />
	  cout << "Exception: " << roException.what() << endl;<br />
	}<br />
}<br />


-- modified at 22:07 Friday 2nd September, 2005
QuestionCreating a colored, transparent CStatic Pin
David Fleming2-Sep-05 14:00
David Fleming2-Sep-05 14:00 
AnswerRe: Creating a colored, transparent CStatic Pin
David Fleming2-Sep-05 22:59
David Fleming2-Sep-05 22:59 
QuestionAbsent Thread Pin
Blake Miller2-Sep-05 10:53
Blake Miller2-Sep-05 10:53 
AnswerRe: Absent Thread Pin
Gary R. Wheeler3-Sep-05 2:36
Gary R. Wheeler3-Sep-05 2:36 
QuestionWhat do employers mean by .Net experience Pin
Brian R2-Sep-05 9:31
Brian R2-Sep-05 9:31 
AnswerRe: What do employers mean by .Net experience Pin
Chris Losinger2-Sep-05 10:43
professionalChris Losinger2-Sep-05 10:43 
QuestionThreading problem.. Pin
Laing,James2-Sep-05 8:42
Laing,James2-Sep-05 8:42 
AnswerRe: Threading problem.. Pin
Gary R. Wheeler3-Sep-05 2:43
Gary R. Wheeler3-Sep-05 2:43 
GeneralRe: Threading problem.. Pin
Laing,James3-Sep-05 7:27
Laing,James3-Sep-05 7:27 
Question:: operator Pin
celllllllll2-Sep-05 7:47
celllllllll2-Sep-05 7:47 
AnswerRe: :: operator Pin
PJ Arends2-Sep-05 8:26
professionalPJ Arends2-Sep-05 8:26 
GeneralRe: :: operator Pin
celllllllll2-Sep-05 8:50
celllllllll2-Sep-05 8:50 
GeneralRe: :: operator Pin
PJ Arends2-Sep-05 9:03
professionalPJ Arends2-Sep-05 9:03 
GeneralRe: :: operator Pin
celllllllll6-Sep-05 10:28
celllllllll6-Sep-05 10:28 
QuestionCPreviewView Class Pin
mikobi2-Sep-05 7:18
mikobi2-Sep-05 7:18 
AnswerRe: CPreviewView Class Pin
PJ Arends2-Sep-05 8:21
professionalPJ Arends2-Sep-05 8:21 
GeneralRe: CPreviewView Class Pin
mikobi2-Sep-05 20:29
mikobi2-Sep-05 20:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.