|
I need a code(working ) for RSA for multiplying 2 large (512 bit prime number)
normal int is 32
i thought of arrays, but dunno how to do with arrays so am asking u all. hope some of u have worked with RSA
Deepchand P
Software Developer
Optiwise Solutions
|
|
|
|
|
Have you consulted any literature by R, S, or A?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hy
I am a newby in encoding/decoding. I am writting a function in C++ that would decode an URL encoded string. It works fine if the string does not contain unicode characters. Whenever I find a "%" I convert the fallowing two digit number from hex to int and add to the returning string the character corespounding to the int. When the URL contains unicode characters there is a "u" after the "%" fallowed by a 4 digit hex. I managed to convert the for digit hex to int. But I am not able to get the character corespounding to this int.
Could anyone give some advice ?
10x in advance
Bobby
bogdanaldo
|
|
|
|
|
Try using the following code for encoding and decoding the URL
CString URLDecode(const CString& inStr)
{
CString res;
for (int x = 0; x < inStr.GetLength(); x++)
{
if (inStr.GetAt(x) == _T('%') && x + 2 < inStr.GetLength() && IsHexDigit(inStr.GetAt(x+1)) && IsHexDigit(inStr.GetAt(x+2)))
{
TCHAR hexstr[3];
_tcsncpy(hexstr, inStr.Mid(x+1, 2), 2);
hexstr[2] = _T('\0');
x += 2;
res.AppendChar((TCHAR)_tcstoul(hexstr, NULL, 16));
}
else
{
res.AppendChar(inStr.GetAt(x));
}
}
return res;
}
CString URLEncode(const CString& sInT)
{
CStringA sIn(sInT);
LPCSTR pInBuf = sIn;
CString sOut;
LPTSTR pOutBuf = sOut.GetBuffer(sIn.GetLength() * 3);
if(pOutBuf)
{
while (*pInBuf)
{
if (_ismbcalnum((BYTE)*pInBuf))
*pOutBuf++ = (BYTE)*pInBuf;
else
{
*pOutBuf++ = _T('%');
*pOutBuf++ = toHex((BYTE)*pInBuf >> 4);
*pOutBuf++ = toHex((BYTE)*pInBuf % 16);
}
pInBuf++;
}
*pOutBuf = _T('\0');
sOut.ReleaseBuffer();
}
return sOut;
}
-- modified at 6:27 Monday 19th February, 2007
|
|
|
|
|
please use <pre></pre> !!!
|
|
|
|
|
Are you looking for something like UrlCanonicalize() , or maybe the UrlEescape() /UrlUnescape() pair?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I want to start a thread at a particular interval
like if i set it at 4 sec then that thread should run every 4th sec..
How shold i set this timer
Can anybody help me in this...
thanxs in advance
|
|
|
|
|
please set a nickname in your profile so that everybody can identify you.
BTW, are you using MFC ? is so, you can use the CWnd::SetTimer() function for this purpose
|
|
|
|
|
toxcct wrote: please set a nickname in your profile so that everybody can identify you.
Since s/he continues to receive help, what incentive does s/he have for complying?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
because if s/he continues, fire will fall on her/his head
|
|
|
|
|
There are more than one anonymous things around.
This one has only 2 posts.
It seems there is a loophole in the register user dialog of codeproject.
Failure is not an option - it's built right in.
|
|
|
|
|
If it's a worker thread you could create it once (as thread creation in Win32 is relatively expensive) and have it Sleep between runs. For example:
void __cdecl ThreadFunc(void *)
{
for( ; ; )
{
DWORD WaitRes = WaitForSingleObject(g_hKillThreadEvent, 4000);
if (WaitRes==WAIT_OBJECT_0)
{
return;
}
}
}
Steve
|
|
|
|
|
1st of all sorry for posting this entire program hope its not a large 1. This program has been tested in gcc,msvc,tc to give the same result. My question is how does it work
#include <stdio.h>
void Call_Aswathy()
{
printf("Yes Girish........\n\n");
}
int Call_Girish(int w_argc)
{
printf("Aswathy do u hear me...\n\n");
unsigned int *p = (unsigned int *)&w_argc;
*p = *(p-1);
*(p-1) = (unsigned int) &Call_Aswathy;
return w_argc;
}
int main(int argc,char **argv)
{
unsigned int *p = (unsigned int *) &argc;
*p = *(p-1);
*(p-1) = (unsigned int) &Call_Girish;
return 0;
}
if some1 has posted a this question or similar question before plz post the exact link or mail the link
thx in advance
-- modified at 5:36 Monday 19th February, 2007
-- modified at 5:38 Monday 19th February, 2007
-- modified at 5:50 Monday 19th February, 2007
Deepchand P
Software Developer
Optiwise Solutions
|
|
|
|
|
Deepchand P wrote: Plz give me a satisfiable reply
1) we're answering for free, so please be indulgent if the answers don't satisfy you
2) this is not a "satisfiable" title for a message
3) please use <pre></pre> tags around your code samples so that we can see your format correctly... (thanks for your consequent modification)
4) What is your question actually ? have you tried using your debugger ? what part of it don't you understand ?
5) please avoid typing in SMS; use full word instead. everybody can plainly understand you like that
|
|
|
|
|
kindly excuse as its my 2nd post i just want to know this program works.
When i analysed the program the functions are called after the main prog return 0. how does this happen?
Deepchand P
Software Developer
Optiwise Solutions
|
|
|
|
|
u got any corrections plz correct me cos am new to posting
i tried using the debugger but the messages are printed after the main returns 0
Deepchand P
Software Developer
Optiwise Solutions
|
|
|
|
|
How about adding breakpoints inside the functions, and see what the callstack looks like when they get called
|
|
|
|
|
This is probably one of the wurst ways to call a function on exit of another function.
To see what happens one should know a little/lot about the way c/c++ works and look at the assembly code.
Simply said: the programmer (prob a hacker who deserves to be shot ) is overwriting the return address of the function. So when the function exit it returns to the newly linked function instead.
codito ergo sum
|
|
|
|
|
BadKarma wrote: This is probably one of the wurst ways to call a function on exit of another function.
Unless you take job security into consideration.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote:
Unless you take job security into consideration.
In that case this guy deserves a medal.
codito ergo sum
|
|
|
|
|
Hi !
All , I want to add file image icon with my file name when i add the type of file in the listview .
can any have idea about adding the image in the listview???
Amit
|
|
|
|
|
amitmistry_petlad wrote: I want to add file image icon with my file name when i add the type of file in the listview .
Use SHGetFileInfo .
SHFILEINFO shfi = { 0 };
SHGetFileInfo( _T( "your_bmp_file_name.bmp" ),
FILE_ATTRIBUTE_NORMAL,
&shfi, sizeof(shfi),
SHGFI_ICON|SHGFI_USEFILEATTRIBUTES ); This code retrieves icon associated with bmp file type.
|
|
|
|
|
Thanks !
but how can I add the icon in the listview. Look at the source code.
LvItem.iItem=0;
LvItem.iSubItem=0;
HIMAGELIST llistaImatgesG=ImageList_Create(GetSystemMetrics(SM_CXICON),GetSystemMetrics(SM_CYICON),ILC_COLOR32|ILC_MASK,1,1);
HICON hIcona=LoadIcon(hInst,MAKEINTRESOURCE(IDI_QUESTION));
<code>
SHFILEINFO shfi = { 0 };
SHGetFileInfo( _T( "quest.bmp" ),FILE_ATTRIBUTE_NORMAL,&shfi, sizeof(shfi),SHGFI_ICON|SHGFI_USEFILEATTRIBUTES );
</code>
|
|
|
|
|
amitmistry_petlad wrote: but how can I add the icon in the listview
SHFILEINFO has an hIcon member that holds the icon of the corresponding file type. You can use that icon.
|
|
|
|
|
Hi all.
result of this code is "cant create File" and I dont know why.
can help??
<br />
wchar_t FileName[250]= L"C:\\File Manager Service Log\\log.txt";<br />
wchar_t *pFileName = MySystemTime(FileName);<br />
HANDLE F;<br />
<br />
F=CreateFile((LPCTSTR)pFileName,<br />
GENERIC_READ, <br />
FILE_SHARE_READ,<br />
NULL,<br />
CREATE_NEW,<br />
FILE_ATTRIBUTE_NORMAL,<br />
0);<br />
<br />
<br />
<br />
if(F == INVALID_HANDLE_VALUE)<br />
{<br />
printf("cant create File");<br />
<br />
getchar();<br />
return;<br />
}<br />
|
|
|
|