📄 desdlg.cpp
字号:
// DESDlg.cpp : implementation file
//
#include "stdafx.h"
#include "DES.h"
#include "DESDlg.h"
#include "Desendec.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDESDlg dialog
CDESDlg::CDESDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDESDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CDESDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CDESDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDESDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDESDlg, CDialog)
//{{AFX_MSG_MAP(CDESDlg)
ON_BN_CLICKED(IDC_DEMO, OnDemo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDESDlg message handlers
BOOL CDESDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CenterWindow(GetDesktopWindow()); // center to the hpc screen
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
void CDESDlg::OnDemo()
{
char key[]={0,2,0,0,9,3,5,1,9,8,0,0,9,1,7},buf[255];
char str[]="Welcome to My 3-DES Test! --WangJunchuan";
CString a,b;
memset(buf, 0, sizeof(buf));
strcpy(buf, str);
b=CString(buf);
a.Format(_T("Before encrypting"));
AfxMessageBox(a+b);
Des_Go(buf, buf, sizeof(str), key, sizeof(key), ENCRYPT);
a.Format(_T("After encrypting"));
b=CString(buf);
AfxMessageBox(a+b);
Des_Go(buf, buf, sizeof(str), key, sizeof(key), DECRYPT);
a.Format(_T("After encrypting"));
b=CString(buf);
AfxMessageBox(a+b);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -