VC+문자열 String MD5 컴 퓨 팅 도구 VS 2008 프로젝트
실행 효 과 는 다음 과 같 습 니 다:
핵심 코드:
void CEncryptByMd5Dlg::OnButtonOk()
{
// TODO: Add your control notification handler code here
UpdateData(true);
unsigned int len=0;
char *cTemp =NULL;
if(m_bType==0)
{
len=m_sText.GetLength();
cTemp=(char*)(LPCTSTR)m_sText;
}
else
{
len=CStringW(m_sText).GetLength()*2;
cTemp=(char*)ANSI2UNICODE(m_sText);
}
char *cIdentity;
CMd5A md5;
cIdentity = md5.MDString(cTemp,len);
m_sEncrypt = CString(cIdentity);
if(m_bUpper==TRUE)
{
m_sEncrypt.MakeUpper();
}
else
{
m_sEncrypt.MakeLower();
}
UpdateData(false);
}
void CEncryptByMd5Dlg::OnBnClickedBtnCompare()
{
// TODO: Add your control notification handler code here
UpdateData(true);
if(m_sEncrypt==m_szMD5_2)
{
MessageBox(_T(" !"),_T(" "),MB_OK|MB_ICONINFORMATION);
}
else
{
MessageBox(_T(" !"),_T(" "),MB_OK|MB_ICONERROR);
}
UpdateData(FALSE);
}
void CEncryptByMd5Dlg::OnEnChangeEdit1()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
OnButtonOk();
// TODO: Add your control notification handler code here
}
char * CEncryptByMd5Dlg::Unicode2ANSI(CString strSource)
{
if (strSource.IsEmpty()) return NULL;
char *pBuffer = NULL;
int nBufferSize = 0;
#ifdef _UNICODE
nBufferSize = WideCharToMultiByte(CP_ACP, 0, (LPCTSTR)strSource, -1, NULL, 0, NULL, NULL) + 1;
pBuffer = new char[nBufferSize];
memset(pBuffer, 0, sizeof(char)*nBufferSize);
WideCharToMultiByte(CP_ACP, 0, (LPCTSTR)strSource, -1, pBuffer, nBufferSize, NULL, NULL);
#else
nBufferSize = strSource.GetLength() + 1;
pBuffer = new char[nBufferSize];
memset(pBuffer, 0, sizeof(char)*nBufferSize);
strcpy_s(pBuffer, nBufferSize, (LPCTSTR)strSource);
#endif
return pBuffer;
}
wchar_t * CEncryptByMd5Dlg::ANSI2UNICODE(CString pData)
{
int nLength = MultiByteToWideChar(CP_ACP, 0, pData, -1, NULL, 0);
wchar_t *pwBuffer = new wchar_t[nLength + 1];
memset(pwBuffer, 0, sizeof(wchar_t)*(nLength + 1));
MultiByteToWideChar(CP_ACP, 0, pData, -1, pwBuffer, nLength);
return pwBuffer;
}
void CEncryptByMd5Dlg::OnBnClickedCheckUpper()
{
OnButtonOk();
// TODO: Add your control notification handler code here
}
void CEncryptByMd5Dlg::OnBnClickedRadio1()
{
OnButtonOk();
// TODO: Add your control notification handler code here
}
void CEncryptByMd5Dlg::OnBnClickedRadio2()
{
OnButtonOk();
// TODO: Add your control notification handler code here
}
VS 2008 MFC 프로젝트 소스 다운로드:클릭 하여 링크 열기
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Visual Studio 2019의 C++/CLI에서 출력되는 바이너리 경로 변경Visual C++ 프로젝트에서는 디폴트로 솔루션과 같은 계층에 플랫폼의 폴더( Win32 라든지 x64 라든지)나 구성 폴더( Debug 라든지 Release 라든지)가 만들어지지만, 여러가지 구성을 바꾸고 있으면...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.