www.pudn.com > endecipher.rar > Dlg_Idea.cpp


// Dlg_Idea.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Cipher.h" 
#include "Dlg_Idea.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CDlg_Idea dialog 
 
 
CDlg_Idea::CDlg_Idea(CWnd* pParent /*=NULL*/) 
	: CDialog(CDlg_Idea::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CDlg_Idea) 
	m_cfpath = _T(""); 
	m_cstring = _T(""); 
	m_pfpath = _T(""); 
	m_pstring = _T(""); 
	m_t = 0; 
	m_key = _T("ABCDEFGHIJKLMNOP"); 
	//}}AFX_DATA_INIT 
} 
 
 
void CDlg_Idea::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CDlg_Idea) 
	DDX_Control(pDX, IDC_STATIC_SP, m_sp); 
	DDX_Control(pDX, IDC_STATIC_FP, m_fp); 
	DDX_Control(pDX, IDC_STATIC_File, m_file); 
	DDX_Control(pDX, IDC_STATIC_String, m_string); 
	DDX_Control(pDX, IDC_STATIC_SC, m_sc); 
	DDX_Control(pDX, IDC_STATIC_FC, m_fc); 
	DDX_Control(pDX, IDC_EDIT_PlainS, m_ps); 
	DDX_Control(pDX, IDC_EDIT_CipherS, m_cs); 
	DDX_Control(pDX, IDC_EDIT_PF, m_pfp); 
	DDX_Control(pDX, IDC_EDIT_CF, m_cfp); 
	DDX_Control(pDX, IDC_BUTTON_OpenP, m_openpf); 
	DDX_Control(pDX, IDC_BUTTON_OpenC, m_opencf); 
	DDX_Text(pDX, IDC_EDIT_CF, m_cfpath); 
	DDX_Text(pDX, IDC_EDIT_CipherS, m_cstring); 
	DDX_Text(pDX, IDC_EDIT_PF, m_pfpath); 
	DDX_Text(pDX, IDC_EDIT_PlainS, m_pstring); 
	DDX_Radio(pDX, IDC_RADIO_S, m_t); 
	DDX_Text(pDX, IDC_KEY_EDIT, m_key); 
	DDV_MaxChars(pDX, m_key, 16); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CDlg_Idea, CDialog) 
	//{{AFX_MSG_MAP(CDlg_Idea) 
	ON_BN_CLICKED(IDC_RADIO_S, OnRadioS) 
	ON_BN_CLICKED(IDC_RADIO_F, OnRadioF) 
	ON_BN_CLICKED(IDC_BUTTON_Encipher, OnBUTTONEncipher) 
	ON_BN_CLICKED(IDC_BUTTON_Decipher, OnBUTTONDecipher) 
	ON_BN_CLICKED(IDC_BUTTON_OpenP, OnBUTTONOpenP) 
	ON_BN_CLICKED(IDC_BUTTON_OpenC, OnBUTTONOpenC) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CDlg_Idea message handlers 
 
void CDlg_Idea::OnRadioS()  
{ 
	// TODO: Add your control notification handler code here 
	m_t=0; 
	m_sp.EnableWindow(true); 
	m_sc.EnableWindow(true); 
	m_string.EnableWindow(true); 
	m_ps.EnableWindow(true); 
	m_cs.EnableWindow(true); 
 
	m_pfp.EnableWindow(false); 
	m_cfp.EnableWindow(false); 
	m_file.EnableWindow(false); 
	m_openpf.EnableWindow(false); 
	m_opencf.EnableWindow(false); 
	m_fc.EnableWindow(false); 
	m_fp.EnableWindow(false); 
	UpdateData(true); 
	m_cfpath=""; 
	m_pfpath=""; 
	UpdateData(false); 
} 
 
void CDlg_Idea::OnRadioF()  
{ 
	// TODO: Add your control notification handler code here 
	m_t=1; 
	m_sp.EnableWindow(false); 
	m_sc.EnableWindow(false); 
	m_string.EnableWindow(false); 
	m_ps.EnableWindow(false); 
	m_cs.EnableWindow(false); 
 
	m_pfp.EnableWindow(true); 
	m_cfp.EnableWindow(true); 
	m_file.EnableWindow(true); 
	m_openpf.EnableWindow(true); 
	m_opencf.EnableWindow(true); 
	m_fc.EnableWindow(true); 
	m_fp.EnableWindow(true); 
	UpdateData(true); 
	m_cstring=""; 
	m_pstring=""; 
	UpdateData(false); 
} 
 
char * CDlg_Idea::Encipher(CString a) 
{ 
	char * c; 
	int lr,i,j,k,s,t; 
	lr=strlen(a); 
	c=new char [lr*8+64]; 
	t=-1; 
	k=0; 
	for(i=0;i