|
Anyone plz help me out with how to decrypt a string in vc++ urgently?
|
|
|
|
|
|
hai Alok Sir
actually if i enter into the text box a string like 'a' and press the encrypt button..
the output i get is 113.
so if i enter 113 for decryption i should get back the result as 'a' itself...
if i give something like 'asd' as string for encryption..
i am not getting it back while decrypting.
Neha
|
|
|
|
|
Some things:
1: What encryption algorithm do you use?
2: Are you entering all the values / strings in one edit box?
3: Smells like homework!
4: If you do enter all the values / strings in one edit box, the algorithm will never work unless you restrict to alphabetical characters and no numerical characters.
I also got the blogging virus..[^]
|
|
|
|
|
Hallo Bob
I am using the RSA Algorithm...
i want to encrypt and decrypt the alphabetical characters and numerical characters to and from the database.
Regards,
Neha
|
|
|
|
|
Hello,
As I recall from my Encryption classes at school, you need 2 numbers:
1: Prime number 1 (q)
2: Prime number 2 (p)(different than q)
With these numbers you have to do some magic and voila public key encryption and decryption...
The algorithm can be found here[^]
With this information, you have to implement you own encryption and decryption functions. Hope this helps.
I also got the blogging virus..[^]
|
|
|
|
|
|
hai Alok
I am using the RSA Algorithm...
i want to encrypt and decrypt the alphabetical characters and numerical characters to and from the database.
Regards,
Neha
|
|
|
|
|
|
Hai Alok,
Actually I got an RSA pgm from the internet for encrypting and decrypting into a file.But what actually i need is to encrypt and decrypt to and from the Access database.
Regards,
Neha
|
|
|
|
|
Simple Logic:-
Retriving Text
Get data from Access--> Apply Decryption --> show Text
Saving Text
Text->Apply encryption ->save data.
Now tell me at which point you facing problem!!!! and what
[Vote One Here, Complete my Survey....]
Alok Gupta visit me at http://www.thisisalok.tk
"I Think Believe this Will Help"
|
|
|
|
|
Alok,
I am not getting the decrypted part.
|
|
|
|
|
|
Alok,
I am not getting the decrypted one while retrieving from the database...
Regards,
neha
|
|
|
|
|
Hi,
I created a macro to extract all text along with the speakernotes to a textfile. When I run this macro from visual basic it processed the (very large) powerpoint presentation in 5 sec.
Now I programmed exactly the same thing in Visual C++ but it takes 40 seconds to process the same file
Detail: I am not running my program in debug mode so that doesn't slow the process down
Anyone who has an explanation for this ??
The macro in VB and my code in C++ is attached to the post.
Note that I use Disphelper to communicate with the COM objects
Macro to extract all text and speakernotes in Visual Basic
----------------------------------------------------------
Sub ExportText()
Dim oPres As Presentation
Dim oSlides As Slides
Dim oSld As Slide 'Slide Object
Dim oShp As Shape 'Shape Object
Dim oShp2 As Shape 'Shape Object
Dim NotesText As String
Dim iFile As Integer 'File handle for output
iFile = FreeFile 'Get a free file number
Dim PathSep As String
Dim FileNum As Integer
PathSep = "\"
Set oPres = ActivePresentation
Set oSlides = oPres.Slides
FileNum = FreeFile
'Open output file
' NOTE: errors here if file hasn't been saved
Open oPres.Path & PathSep & "AllText.TXT" For Output As FileNum
For Each oSld In oSlides 'Loop thru each slide
For Each oShp In oSld.Shapes 'Loop thru each shape on slide
'Check to see if shape has a text frame and text
If oShp.HasTextFrame And oShp.TextFrame.HasText Then
Print #iFile, oShp.TextFrame.TextRange
End If ' Has text frame/Has text
Next oShp
For Each oShp2 In oSld.NotesPage.Shapes
If oShp2.HasTextFrame And oShp2.TextFrame.HasText Then
Print #iFile, oShp2.TextFrame.TextRange
End If ' Has text frame/Has text
Next oShp2
Next oSld
'Close output file
Close #iFile
End Sub
Same thing programmed in C++
-----------------------------
void Converter::convertPPT(const string &s1, const string &s2)
{
CDhInitialize init;
CDispPtr ppApp, ppPres, ppSlides, ppSlide, ppShape1, ppShape2;
dhToggleExceptions(TRUE);
//dhToggleExceptions(FALSE);
try
{
const char * inpath = s1.c_str();
const char * outpath = s2.c_str();
dhCheck( dhCreateObject(L"PowerPoint.Application", NULL, &ppApp) );
dhPutValue(ppApp, L".Assistant.On = %b", FALSE);
dhGetValue(L"%o", &ppPres, ppApp, L".Presentations.Open(%s,%d,%d,%d)", inpath,0,0,0);
remove(outpath);
ofstream outfile(outpath, ios::app);
const char * text = "";
bool one, two;
FOR_EACH(ppSlide, ppPres, L".Slides")
{
FOR_EACH(ppShape1, ppSlide, L".Shapes")
{
dhGetValue(L"%b", &one, ppShape1, L".HasTextFrame");
if (one)
{
dhGetValue(L"%b", &two, ppShape1, L".TextFrame.HasText");
if (two)
{
dhGetValue(L"%T", &text, ppShape1, L".TextFrame.TextRange");
outfile << text << endl;
}
}
} NEXT(ppShape1);
FOR_EACH(ppShape2, ppSlide, L".NotesPage.Shapes")
{
dhGetValue(L"%b", &one, ppShape2, L".HasTextFrame");
if (one)
{
dhGetValue(L"%b", &two, ppShape2, L".TextFrame.HasText");
if (two)
{
dhGetValue(L"%T", &text, ppShape2, L".TextFrame.TextRange");
outfile << text << endl;
}
}
} NEXT(ppShape2);
} NEXT (ppSlide);
outfile.close();
}
catch (string errstr)
{ cerr << "Fatal error details:" << endl << errstr << endl; }
dhCallMethod(ppApp, L".Quit");
}
|
|
|
|
|
hello
can someone please tell me what is wrong with this function I wrote:
<br />
<br />
BOOL scan(char *url2search4)<br />
<br />
{<br />
MessageBox(0,url2search4,"a",MB_OK);<br />
<br />
INTERNET_CACHE_ENTRY_INFO icei;<br />
<br />
HANDLE the_cache_handle;<br />
<br />
unsigned long buffer_size=10324;<br />
<br />
the_cache_handle =FindFirstUrlCacheEntry(NULL,&icei,&buffer_size);<br />
<br />
if(the_cache_handle==NULL)<br />
{<br />
DisplayError(GetLastError());<br />
return FALSE;<br />
}<br />
<br />
<br />
while(FindNextUrlCacheEntry(the_cache_handle,&icei,&buffer_size))<br />
<br />
{<br />
MessageBox(0,icei.lpszSourceUrlName,"uite ce am gasit",MB_OK);<br />
<br />
if(strstr(icei.lpszSourceUrlName,url2search4)==0)<br />
{<br />
<br />
MessageBox(0,"egal","equal",MB_OK);<br />
return TRUE;<br />
}<br />
<br />
}<br />
<br />
return FALSE;<br />
}<br />
<br />
everything builds ok and runs but I never get to actually find a url even thought when I go to
C:\Documents and Settings\[MyUserName].000\Local Settings\Temporary Internet Files
I can see it there
Similar functions from Wininet.h work, like DeleteUrlCacheEntry
No matter what I do the_cache_handle is always NULL and the GetLastError fucntion returns "this parrameter is incorect"
here is the Display Error Function also if you think this might help
<br />
<br />
void DisplayError(DWORD dwError ) <br />
{<br />
<br />
LPTSTR lpBuffer = NULL;<br />
<br />
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError,<br />
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpBuffer, 0, NULL );<br />
if(dwError!=0) MessageBox(GetActiveWindow(), lpBuffer, "Error", MB_OK|MB_ICONERROR);<br />
LocalFree( lpBuffer );<br />
<br />
<br />
}<br />
Please help
thank you in advance
|
|
|
|
|
The first problem I see is you're not seting the dwStructSize member of your INTERNET_CACHE_ENTRY_INFO struct.
You're also telling FindNextUrlCacheEntry() that you are passing in a 10324-byte buffer, but your actual buffer isn't that big (it's just one struct).
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
The INTERNET_CACHE_ENTRY_INFO structure displays two common Windows API features. It contains a structure size member (dwStructSize ) for versioning purposes - compatibility can be maintained if further fields are later added. The declared structure also does not completely describe the returned data - in fact the structure is only a header, with more data following on.
I think you're getting ERROR_INVALID_PARAMETER because the size isn't recognized, because you haven't initialized it. You'll need to allocate memory dynamically because you don't know how big the cache data will be.
Your code probably needs to be something like:
BOOL scan( char* url2search4 )
{
INTERNET_CACHE_ENTRY_INFO* picei = NULL;
DWORD dwBufferSize = 0;
HANDLE cacheHandle = FindFirstUrlCacheEntry( NULL, picei, &dwBufferSize );
BOOL success = FALSE;
while ( cacheHandle == NULL && GetLastError() == ERROR_INSUFFICIENT_BUFFER )
{
delete[] (TCHAR*) picei;
picei = (INTERNET_CACHE_ENTRY_INFO*) new TCHAR[dwBufferSize];
picei->dwStructSize = sizeof( INTERNET_CACHE_ENTRY_INFO );
cacheHandle = FindFirstUrlCacheEntry( NULL, picei, &dwBufferSize );
}
if ( cacheHandle != NULL )
{
for( ; ; )
{
puts( picei->lpszSourceUrlName );
success = FindNextUrlCacheEntry( cacheHandle, picei, &dwBufferSize );
while ( !success && GetLastError() == ERROR_INSUFFICIENT_BUFFER )
{
picei = (INTERNET_CACHE_ENTRY_INFO*) new TCHAR[dwBufferSize];
picei->dwStructSize = sizeof( INTERNET_CACHE_ENTRY_INFO );
success = FindNextUrlCacheEntry( cacheHandle, picei, &dwBufferSize );
}
if ( !success )
break;
}
FindCloseUrlCache( cacheHandle );
}
delete[] (TCHAR*) picei;
return TRUE;
} Hope this helps.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
thank you mister
the code works well except for one thing
I don't know how to compare the string I get from the FindNextUrlCacheEntry function with the one I have as a parameter:
if I do like this
<br />
<br />
if(strcmpi(picei->lpszSourceUrlName,url2search4)==0)<br />
{<br />
MessageBox(0,"egal","equal",MB_OK);<br />
return TRUE;<br />
}<br />
<br />
I get an unhandeled exception error
I also tryed with StrCmpI but it also doesn't work
any ideas on how to make this work
|
|
|
|
|
this works but it takes up a lot of memory
every time this thing completes a cicle the memory usage increases and then after about an hour I get a message from windows telling me that memory is to low
I see that you use delete to delete that structure but it doesn't seem to be working because memory usage just keeps getting bigger and bigger
Is there no way around this?
|
|
|
|
|
i am using an mfc applicaion in cform view and i need to send a custom messge from a dialog in the applicaion to another cform , in another view.
i use the postMessage but it is not working. it work only in the form in which the message processing is done. can any body help me?
thanks and regards
kittu
|
|
|
|
|
1st define your message
#define WM_MYMESSAGE WM_USER+0x100
2nd create your message handler in the window:
in the header:
LRESULT OnMyMessage(WPARAM wParam, LPARAM lParam);
in the cpp define your message call in the message table:
ON_MESSAGE(WM_MYMESSAGE, OnMyMessage)
still in the cpp implement your message handler:
LRESULT CMyWnd::OnMyMessage(WPARAM wParam, LPARAM lParam)<br />
{<br />
...<br />
return ...;<br />
}
have fun.
There is no spoon.
|
|
|
|
|
Actually, WM_APP is preferred over WM_USER . See this[^] article.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
That caught me offgard, I have not looked up WM_USER since the 3.1 days.
WM_USER: Used by private window classes. (it's not obsolete)
WM_APP: Used by applications. (non-class specific)
If you want to define messages that can be meaningful for all classes in your application, then you need to use WM_APP. In this case you should NOT difine two messages with the same value.
If you use WM_APP to difine user specific private window class messages, then you run the risk of clashing with user specific application defined messages.
The creator of the private windows class and the creator of the main application may not be the same person.
Private widows class messages and application wide messages are two different things.
So, do not believe everything you read. Be carefull!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
And then there is alway my favorite - RegisterWindowMessage - MSDN: The RegisterWindowMessage function defines a new window message that is guaranteed to be unique throughout the system. The message value can be used when sending or posting messages.
|
|
|
|
|