00001 /*********************************************************************** 00002 * 00003 * KRYPTOS - Educational software for teaching cryptography 00004 * For more information, see http://www.kryptosproject.org/ 00005 * Submissions may be sent to kryptos@gmu.edu (see web site for details) 00006 * 00007 * 00008 * Copyright (c) 2002-2006 George Mason University 00009 * 00010 * Permission is hereby granted, free of charge, to any person obtaining 00011 * a copy of this software and associated documentation files (the 00012 * "Software"), to deal in the Software without restriction, including 00013 * without limitation the rights to use, copy, modify, merge, publish, 00014 * distribute, sublicense, and/or sell copies of the Software, and to 00015 * permit persons to whom the Software is furnished to do so, subject 00016 * to the following conditions: 00017 * 00018 * The above copyright notice and this permission notice shall be 00019 * included in all copies or substantial portions of the Software. 00020 * 00021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00022 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00023 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00024 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 00025 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 00026 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 00027 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00028 * 00029 ***********************************************************************/ 00030 #include "AlgorithmSheet.h" 00031 #include "CPUTicker.h" 00032 #include "CryptoLink.h" 00033 #include "Splasher.h" 00034 #include "afxwin.h" 00035 00036 00037 // KryptosDlg.h : header file 00038 #if !defined(AFX_KRYPTOSDLG_H__3BBCB493_56D6_4370_89EF_62ACDD21039B__INCLUDED_) 00039 #define AFX_KRYPTOSDLG_H__3BBCB493_56D6_4370_89EF_62ACDD21039B__INCLUDED_ 00040 00041 #if _MSC_VER > 1000 00042 #pragma once 00043 #endif // _MSC_VER > 1000 00044 00046 // CKryptosDlg dialog 00047 00052 class CKryptosDlg : public CDialog 00053 { 00054 // Construction 00055 public: 00057 int DIRECTION; 00058 CKryptosDlg(CWnd* pParent = NULL, CSplashFactory* splashFactory = NULL); // standard constructor 00059 00061 CSplashFactory* m_pSplashFactory; 00062 00064 CMenu m_menu; 00065 00067 CEdit m_ProgressBar2; 00069 CFont m_Font; 00070 00075 CAlgorithmSheet* p_AlgorithmSheet; 00076 00081 CCryptoLink* m_CryptoLink; 00082 00084 int sheet_size; 00085 00087 CBrush m_BrushBlue; 00089 COLORREF m_Blue; 00090 00092 CString m_programTitle; 00093 00094 bool CKryptosDlg::FixedParameters(int algorithm); 00095 00096 // Dialog Data 00097 //{{AFX_DATA(CKryptosDlg) 00099 enum { IDD = IDD_KRYPTOS_DIALOG }; 00101 CString m_CPU_time; 00103 CString m_CPU_cycles; 00105 CString m_CPU_cycles1; 00107 CString m_CPU_time1; 00108 //}}AFX_DATA 00109 00110 // ClassWizard generated virtual function overrides 00111 //{{AFX_VIRTUAL(CKryptosDlg) 00112 public: 00113 virtual BOOL PreTranslateMessage(MSG* pMsg); 00114 virtual BOOL DestroyWindow(); 00115 00116 protected: 00117 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 00118 //}}AFX_VIRTUAL 00119 public: 00120 void FormatCycles(CString &s); 00121 void HideRight(); 00122 void CleanLeft(); 00123 //BOOL isPentium; 00124 00125 // Implementation 00126 protected: 00128 HICON m_hIcon; 00130 double m_CPU_frequency; 00132 double m_CPU_avg_dev; 00133 00134 // Generated message map functions 00135 //{{AFX_MSG(CKryptosDlg) 00136 virtual BOOL OnInitDialog(); 00137 afx_msg void OnSysCommand(UINT nID, LPARAM lParam); 00138 afx_msg void OnDestroy(); 00139 afx_msg void OnPaint(); 00140 afx_msg BOOL OnEraseBkgnd(CDC* pDC); 00141 afx_msg HCURSOR OnQueryDragIcon(); 00142 afx_msg void OnUpdateStatusSend(CCmdUI* pCmdUI); 00143 afx_msg void OnUpdateStatusRec(CCmdUI* pCmdUI); 00144 afx_msg void OnUpdateOperationEnc(CCmdUI* pCmdUI); 00145 afx_msg void OnUpdateOperationDec(CCmdUI* pCmdUI); 00146 afx_msg void OnUpdateOperationSign(CCmdUI* pCmdUI); 00147 afx_msg void OnUpdateOperationVer(CCmdUI* pCmdUI); 00148 afx_msg void OnUpdateOperationHash(CCmdUI* pCmdUI); 00149 afx_msg void OnUpdateOperationPkEnc(CCmdUI* pCmdUI); 00150 afx_msg void OnUpdateOperationPkDec(CCmdUI* pCmdUI); 00151 afx_msg void OnUpdateOperationMacGen(CCmdUI* pCmdUI); 00152 afx_msg void OnUpdateOperationMacVer(CCmdUI* pCmdUI); 00153 afx_msg void OnAlgorithmSetAlg(); 00154 afx_msg void OnUpdateAlgorithmSetAlg(CCmdUI* pCmdUI); 00155 afx_msg void OnAlgorithmparametersSetAlgPara(); 00156 afx_msg void OnUpdateAlgorithmparametersSetAlgPara(CCmdUI* pCmdUI); 00157 afx_msg void OnUpdateModeSetMode(CCmdUI* pCmdUI); 00158 afx_msg void OnModeSetMode(); 00159 afx_msg void OnUpdateInputoutputChoosefileio(CCmdUI* pCmdUI); 00160 afx_msg void OnInputoutputChoosefileio(); 00161 virtual void OnOK(); 00162 virtual void OnCancel(); 00163 afx_msg void OnStatusExit(); 00164 afx_msg void OnHelpAbout(); 00165 afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); 00166 afx_msg void OnSetfocusTnwDialogStatus(); 00167 afx_msg void OnKillFocus(CWnd* pNewWnd); 00168 afx_msg void OnStatusSend(); 00169 afx_msg void OnStatusRec(); 00170 afx_msg void OnOperationEnc(); 00171 afx_msg void OnOperationDec(); 00172 afx_msg void OnOperationPkEnc(); 00173 afx_msg void OnOperationPkDec(); 00174 afx_msg void OnOperationSign(); 00175 afx_msg void OnOperationVer(); 00176 afx_msg void OnOperationHash(); 00177 afx_msg void OnOperationMacGen(); 00178 afx_msg void OnOperationMacVer(); 00179 afx_msg void OnTnwDialogButtonTransform(); 00180 afx_msg void OnTimer(UINT nIDEvent); 00181 afx_msg void OnKeyGeneratekey(); 00182 afx_msg void OnUpdateKeyGeneratekey(CCmdUI* pCmdUI); 00183 afx_msg void OnButton1(); 00184 afx_msg void OnUpdateOperationHashVer(CCmdUI* pCmdUI); 00185 afx_msg void OnOperationHashVer(); 00186 afx_msg void OnTiming(); 00187 afx_msg void OnLibSet(); //library selection 00188 //}}AFX_MSG 00189 DECLARE_MESSAGE_MAP() 00190 public: 00191 afx_msg void OnEnChangeTnwDialogCpuTime(); 00192 }; 00193 00194 //{{AFX_INSERT_LOCATION}} 00195 // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 00196 00197 #endif // !defined(AFX_KRYPTOS_H__3BBCB493_56D6_4370_89EF_62ACDD21039B__INCLUDED_)