www.pudn.com > AESRijnd.rar   To Read all the content


[file head]:
// RijndView.cpp : implementation of the CRijndView class
//

#include "stdafx.h"
#include "Rijnd.h"

#include "RijndDoc.h"
#include "RijndView.h"
#include "rijndael.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//定义
rijndael rij;

/////////////////////////////////////////////////////////////////////////////
// CRijndView

IMPLEMENT_DYNCREATE(CRijndView, CFormView)

BEGIN_MESSAGE_MAP(CRijndView, CFormView)
//{{AFX_MSG_MAP(CRijndView)
ON_BN_CLICKED(IDC_ENCRYPTION, OnEncryption)
ON_BN_CLICKED(IDC_UNCRYPTION, OnUncryption)
ON_BN_CLICKED(IDC_ENCRYPTION_SELECT, OnEncryptionSelect)
ON_BN_CLICKED(IDC_UNCRYPTION_SELECT, OnUncryptionSelect)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CFormView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CFormView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CFormView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////
... ...

[file tail]:
... ...
));

if(f2.GetLength()>16!=0)
{
for(i=0;i<(int)(16-f2.GetLength()>16);i++)
{
var[length-16+f2.GetLength()>16+i]=' ';
}
}

f2.Close();
Invalidate(true);

}
EndWaitCursor();
}
}

void CRijndView::OnUncryptionSelect()
{
// TODO: Add your control notification handler code here
char szFilter[] = "all Files(*.*)|*.*||";
CFileDialog FileDlg( TRUE, NULL, NULL, OFN_HIDEREADONLY, szFilter );

if( FileDlg.DoModal() == IDOK )
{
BeginWaitCursor();
CString PathName = FileDlg.GetPathName();
CString filename=FileDlg.GetFileName();
CString first=FileDlg.GetFileTitle();
name=filename.Right(filename.GetLength()-first.GetLength());

{
CFile f2;
if(f2.Open(PathName,CFile::modeRead|CFile::typeBinary )==FALSE)
return;
length=f2.GetLength();

var=new unsigned char [length];
N=length/16;
f2.Read(var,f2.GetLength());
f2.Close();
Invalidate(true);
}
EndWaitCursor();
}
}