|
Is there any existing classes/functions that do md5 encryption, for example "LRESULT MD5(LPCTSTR lpOriginalString, LPTSTR lpEncryptedString)" or something like that that we can directly call in our code? Thanks a lot.
|
|
|
|
|
|
If it doesn't necessarily have to be MD5, you could try my SHA-1 implementation as C++ class:
http://www.codeproject.com/cpp/csha1.asp[^]
SHA-1 produces a 160-bit hash and therefor is generally regarded to be more secure than MD5.
You can also have a look at the implementations I used in my hash calculator:
http://www.codeproject.com/cpp/ReHash.asp[^]
This also includes a MD5 implementation.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Thanks to both of you for the replies, I appreciate that. The reason why I want an md5 api is because I'm cuurently working on a sql server2000 database project which must store user password in md5 encrypted format. I've been using mySQL for a while which has a built-in md5 function so we don't need to do a thing, but in sql server2000 I failed to find any similar features, so I have to do the encryption by myself I guess... To Dominik Reichl, thank you for the article links but it does have to be md5.
|
|
|
|
|
Then go and download my ReHash hash calculator source code. Go to the "algo" directory and grab the files MD5.cpp and MD5.h.
Include these 2 files to your project. These 2 files implement the MD5 standard as described in RFC 1321 by Rivest.
To hash a string, do the following:
char yourstring[] = "this can be a string of any length";
MD5_CTX ctx;
MD5Init(&ctx, 0);
MD5Update(&ctx, (unsigned char *)yourstring, strlen(yourstring));
MD5Final(&ctx); Now ctx.digest[16] contains the 16 hash bytes (MD5 is a 128-bit hash, therefor 16 bytes [16*8=128]).
You could output these 16 bytes like this:
for(int i = 0; i < 16; i++) printf("%02X ", ctx.digest[i]); Hope that helps
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
|
Could help me but to say, as to codify to capture I cosay of bar with of recording machine.
Visual C++ MFC
|
|
|
|
|
Hi. I'm trying to get the pixel length of a string inside a CStatic, so I can chop it off in the middle and put "..." in the middle. The string happens to be a filename. So if C:/WINNT/ABC/XXX/YYY/ZZZ/DEF/COMMAND.COM is too long to fit inside CStatic width, it will be something like C:/WINNT/AB...EF/COMMAND.COM that will fit. I'm using true type font for the CStatic, so I have to calculate this on the fly. The problem is I have to get the DC to do GetTextExtent, and I dont want to override OnPaint method. I was hoping to get this before the OnPaint is called (actually I dont mind looping on SetWindowText until the length fits) Any ideas?
Thanks
|
|
|
|
|
|
Or, if you really want to calculate it yourself, simply get the dc when you need to compute the size manually like this:
...
CWnd *pStatic = GetDlgItem(IDC_MY_STATIC_FILENAME);
CDC *pDC = pStatic->GetDC();
pDC->GetTextExtent() or pDC->DrawText(cText,&oRect,DT_CALCRECT....
your calculations...
pStatic->ReleaseDC(pDC);
|
|
|
|
|
How can I calculate the data rate of a video stream in an avi file (contains two streams, one video, one audio) without knowing the audio details in the same way that windows xp does when you right click on the file and look at the properties tab?
|
|
|
|
|
|
geee. some boolean read only flag, checked in mouse button down handler ignoring the click when set? It's not a pretty elegant, but it works
|
|
|
|
|
well, I'd something like
<br />
class CView<br />
{<br />
...
CView()<br />
{<br />
...
m_bviewLocked = false;<br />
}<br />
<br />
bool m_bviewLocked;<br />
}<br />
<br />
void CView::OnToolLock()<br />
{<br />
m_bviewLocked = !m_bviewLocked;
}<br />
<br />
WM_LBUTTONDOWN handler = where you handles the mouse click<br />
{<br />
if( m_bviewLocked ) return 0;
}<br />
or some variantion to this
|
|
|
|
|
hi..
My code is like that,
CRect Panerc;<br />
<br />
m_wndStatusBar.GetItemRect(m_wndStatusBar.CommandToIndex(ID_INDICATOR_ZEK),&Panerc);<br />
<br />
m_edit.Create(ES_LEFT,Panerc,this,5132);
but not work.
HELPPP!!!
|
|
|
|
|
You need to be more specific than "it doesn't work".
From just looking at it, the window styles aren't enough (you need at least WS_VISIBLE|WS_CHILD ), and the parent window is wrong (it should be m_wndStatusBar since that's where the edit box should go).
--Mike--
Latest blog entry: *drool* (Alyson) [May 10]
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
Hello
I want that one button be deactivate(non active) until an other button was clicked on.
How I can do that?
|
|
|
|
|
One solution is messages. Send a message to the control to make it the default control.
Kuphryn
|
|
|
|
|
|
can i use EnableWindow for that?
|
|
|
|
|
If you are using only Win32 API:
1) Get the handle (HWND) of the button to disable/enable
2) Use the EnableWindow function to enable or disable the button.
Enable: EnableWindow(hwndButton, TRUE);
Disable: EnableWindow(hwndButton, FALSE);
If you are using MFC:
Make a call to the EnableWindow member function of the CWnd class. This way, the parameter hwndButton isn't needed. The member function of CWnd only has 1 parameter: the BOOL flag to enable or disable.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
you mean in class wizard?
|
|
|
|
|
No, you cannot use the class wizard here. You have to code it yourself.
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
can you explain more please i am a newbie in visual c++.
|
|
|
|
|
All required dll of MyApp
ADVAPI32.DLL
COMCTL32.DLL
COMDLG32.DLL
GDI32.DLL
KERNEL32.DLL
MSIMG32.DLL
MSVCRT.DLL
NTDLL.DLL
ODBC32.DLL
RPCRT4.DLL
SHELL32.DLL
SHLWAPI.DLL
USER32.DLL
I have a function to do work "Set AutoRun for My Application"
When MyApp run on WinXPpro => Okay => AutoRun on startup
but when it run on Win98SE => Windows show a ERROR MESSAGEBOX instead of MyApp
Error Picture
BOOL SetAutoRun()<br />
{<br />
<br />
#define REG_SUBKEY_AUTORUN "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"<br />
#define REG_VALUE_AUTORUN "Notebook"<br />
<br />
DWORD dwDisposition;<br />
HKEY hkSub;<br />
<br />
CHAR szFullFileName[255]; <br />
GetModuleFileName(NULL,szFullFileName,sizeof(szFullFileName));<br />
<br />
RegCreateKeyEx(HKEY_LOCAL_MACHINE, <br />
REG_SUBKEY_AUTORUN, <br />
0, <br />
STR_NULL, <br />
0, <br />
KEY_READ | KEY_WRITE, <br />
NULL,<br />
&hkSub, <br />
&dwDisposition);<br />
<br />
if(dwDisposition==REG_OPENED_EXISTING_KEY)<br />
{ <br />
if(RegSetValueEx(hkSub,REG_VALUE_AUTORUN, 0,REG_SZ,(LPBYTE)szFullFileName, strlen(szFullFileName)+1) != ERROR_SUCCESS)<br />
{<br />
RegCloseKey(hkSub);<br />
return FALSE;<br />
}<br />
else<br />
{<br />
RegCloseKey(hkSub);<br />
return TRUE;<br />
} <br />
}<br />
<br />
return FALSE;<br />
}
Could you help me to fix this bug?
thank you!
|
|
|
|