|
how to decrypt the text which was encrypted and stored in a file using BLOWFISH algorithm
|
|
|
|
|
by knowing the encrypting key first...
|
|
|
|
|
iBlowFish.Encrypt((unsigned char*)szDataIn4,
(unsigned char*)szDataOut4, 96, CBlowFish::ECB);
url.Format ("%s",szDataOut4);
fputs(url,fpa);
fputs("\n",fpa);
this is the way i am putting the encrypted data into the file now i need to decrypy it when ever i click the decrypt button and i should get corresponding user details like am storing username and password details of minimum 85 members
|
|
|
|
|
am storing the username and password details getting the corresponding details and encrpting and storing that in a file
now i need to decrypt and should get the corresponding userdetails whom i select from the list this is the way i am encrypting and storing the data
iBlowFish.Encrypt((unsigned char*)szDataIn4,
(unsigned char*)szDataOut4, 96, CBlowFish::ECB);
url.Format ("%s",szDataOut4);
fputs(url,fpa);
fputs("\n",fpa);
|
|
|
|
|
I'm using the CMonthCalCtrl control in an MFC dialog app, the control seems to work fine if it has the focus at all times, however once I select any other items on the dialog and then try to change the date (using the GUI), then the date although it's displayed correctly when I call the GetDay method in my code the day returned is 3-4 days out
has anyone else came across this?
cheers,
|
|
|
|
|
further to this.
I've created a new MFC dialog and added a calander and a drop down box, I've then added the following code on the SelChange method of the calander along with a break point:
CTime myTime ;
m_Calander.GetCurSel ( myTime ) ;
int day = myTime.GetDay ( ) ;
int month = myTime.GetMonth ( ) ;
int year = myTime.GetYear ( ) ;
running the porgram and selecting different dates on the calander gives the correct results, however as soon as I click on the drop down box and then click on another date on this calander the result is incorrect!
Any ideas?
cheers,
Andy
|
|
|
|
|
sort of fixed this problem, instead of using GetCurSel on the calander do this following:
SYSTEMTIME SelectedDateStruct = { 0 };
DateTime_GetSystemtime( m_Calander.GetSafeHwnd(), &SelectedDateStruct);
this seems to always return the correct values (I got this solution from: http://codeguru.earthweb.com/forum/showthread.php?p=990808#post990808[^]
Andy,
|
|
|
|
|
I have somewhat of a strange problem. I have associated a file type with my app, and set all the registry values accordingly. Double clicking the file opens my app and passes the file and path just as it should. From within my app I then check if the file is there.
WIN32_FIND_DATA fd;
HANDLE hand;
hand = FindFirstFile(filename,&fd);
if (hand == INVALID_HANDLE_VALUE) {
MessageBox(0,"File not found",0,0);
return 0;
}
FindClose(hand);
All this works from within the MSVC environment with both release and debug builds. But after installing the app (program files directory) the findfirstfile() always fails. I have tried placing the file in various locations but it can never confirm that it's there.
Any ideas as to what I may be doing wrong?
|
|
|
|
|
FindFirstFile() etc set of file find functions look in the current directory if the full path to the file has not been given. I am not sure, but are you getting the full path, or just the filename? If you are getting the full path, then you could use GetFileAttributes() etc. Also try some way to find the directory from which the file was dropped onto the app.
this is this.
|
|
|
|
|
yes, I am giving the full path. I have also noticed that it's not only this function failing me, none of my openfile functions are able to find/open files.
It doesn't matter what filetype is passed, anything passed on the command line is not found.
|
|
|
|
|
No worries, the problem was the registry setting. It was set up to pass a quoted argument.
|
|
|
|
|
Hi waldermort,
Do you set Directory?
|
|
|
|
|
a game to transform letters read from a file to a prime number. Do and enjoy it!
The goal of this is to construct a C++ program that will read all letters from a specified file and transform them to a prime number.
The tasks you have to perform are:
(A) Read letters in sequence from a specified file, which contains 1 sentence. Transform each letter to the corresponding ASCII value.
For example, if the file contains “What?” then
‘W’ corresponds to 87
‘h’ corresponds to 104
‘a’ corresponds to 97
‘t’ corresponds to 116
(B) Calculate and output r1=the sum of all obtained integers (e.g. r1=87+104+97+116=404)
(C) Calculate and output r2=the length of Syracuse sequence seeded by r1.
Let n be a positive integer and f(n) be the transformation that sends n to n/2 if n is even and sends n to 3n+1 if n is odd. Starting with a positive value u called the seed, the sequence of integers iteratively generated by f and u is called a Syracuse sequence.
For example, starting with the seed u = 1, the subsequent terms of the sequence are 4, 2, and 1. The length of the sequence (excluding the seed) is therefore 3.
For u = 4, the next terms are 2 and 1. The length is 2.
For u = 404, the next terms are 202, 101, 304, 152, 76, 38, 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, and 1. The length is 27.
It is conjectured (this means that we do not have a proof of this fact, only strong evidences) that for any positive seed the sequence will always reach to 1. In fact, computations show that for any seed u less than or equal to 3*2^53, the corresponding sequence always reaches 1. The general case is unknown.
(D) Calculate and output r3=the largest prime factor of r2.
A prime factor of n is a factor of n which is a prime number. A prime number is any integer greater than 1 and only divisible by itself and 1 (e.g. 2, 3, 5, 7, 11, 13, 17 etc). For example, 3 is the largest prime factor of 27 and 7 is the largest prime factor of 49.
Here are some example
Example 1
Enter the name of the input file: in1.txt
963
49
7
Press CTR-C to Leave...
|
|
|
|
|
burp[^]
Er zit een korstje op mijn aars.
|
|
|
|
|
Do you attend Macquarie University, and have Dr. Wang as an instructor?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi all,
In my MDI application, I've handled application exit in menu. But I am not able to handle close button (x) in the title bar. Since, my document is modified, it is showing the "save document yes / no" with default message box title.
How should I handle this?
Thanks in advance,
Sarvan AL
-- modified at 5:28 Monday 3rd April, 2006
|
|
|
|
|
You could handle the WM_CLOSE message for CMainFrame
this is this.
|
|
|
|
|
Hi Khan,
It not even comes to "void CMainFrame::OnClose()".
What to do?
Sarvan AL
|
|
|
|
|
How did you add the handler? Check that the macro for WM_CLOSE is there in the Message Map of CMainFrame:
...<br />
ON_WM_CLOSE()
END_MESSAGE_MAP()
this is this.
|
|
|
|
|
This will do...
Override WindowProc in CMainFrame class...
Add this to MainFrame.h
LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
Add this to MainFrame.cpp
LRESULT CMainFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if(message == WM_SYSCOMMAND && wParam == SC_CLOSE)
{
MessageBox("Closing application");
}
<font color=blue>return</font> CMDIFrameWnd::WindowProc(message, wParam, lParam);
}
Nibu thomas
Software Developer
|
|
|
|
|
Hi Nibu & Khan,
Now also, the result is same. Control is not coming to "CMainFrame::WindowProc(..)"
Sarvan AL
|
|
|
|
|
I did test it. It's working here!
Nibu thomas
Software Developer
|
|
|
|
|
Exactly which frame window are you trying to handle the message for? Do you mean CChildFrame or CMainFrame ? because both the solutions work (WindowProc and WM_CLOSE ).
this is this.
|
|
|
|
|
Hi Nibu & Khan,
I am able to trap the close event by overriding the document class member function, "BOOL SaveModified()".
Now I got the expected results.
Thanks a Lot to spend your precious time for me.
Sarvan AL
-- modified at 7:04 Monday 3rd April, 2006
|
|
|
|
|
Sarvan AL wrote: How should I handle this?
Handle what? If the document has indeed been modified, why would you not want the "save document yes / no" message when the X is clicked?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|