當前位置:首頁 » 密碼管理 » vc密碼加密

vc密碼加密

發布時間: 2023-04-24 00:37:23

㈠ VC++壓縮軟體的加密 我要做壓縮軟體 壓縮時輸入的密碼放在哪裡解壓又在哪裡取得 並比較~

如果你要自己來編寫加解密演算法,得看密碼學相關的書籍,加密的方式有很多種,例如des、aes,這些加密演算法里涉及到初始置換、逆初始置換、輪、e盒、s盒等很多知識。
如果你不想自己寫,那麼到網上找一個人家寫好了的加密類庫,直接調用。你需要做的就是畫一個界面,幾個button,openfiledialog,savefiledialog
這樣的控制項。
另外,md5、sha-1
這些不是加密演算法,這些是散列演算法,是單項函數,不要被誤導了。

㈡ C語言VC++6.0實現一個置換加密

這個應該滿足要求:

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

FILE *fi,*fo;
char ps[20],txt1[1024],txt2[1024];
int plen,ps1[20];
int i,j,k;

void main(){
printf("password? ");
scanf("%s",ps);
plen=strlen(ps);
printf("PASSWORD is %s in length of %d, separated into:\n",ps,plen);
for(i=0;i<plen;i++){ps1[i]=ps[i]-48;printf("%3d",ps1[i]);}

fi=fopen("d:\\datin.txt","ra");
if(fi==NULL)exit(111);

fscanf(fi,"%s\n",txt1);
fclose(fi);

printf("\n\n---TEXT in file d:\\datin.txt before encoding : ---\n%s\n",txt1);

fo=fopen("d:\\datout.txt","wa");
if(fo==NULL)exit(222);

for(j=0;j<strlen(txt1);j++){
for(i=0;i<plen;i++)fprintf(fo,"%c",txt1[ps1[i]-1+j]);
j+=plen-1;
}
fclose(fo);

fi=fopen("d:\\datout.txt","ra");
fscanf(fi,"%s\n",txt2);
fclose(fi);

printf("\n---TEXT in file d:\\datout.txt after encoding : ---\n%s",txt2);

printf("\n");

}

// contents in datin.txt:
//

㈢ VC 簡單加密!

#include <stdio.h>
#include <string.h>void main()
{
char a[50] = "加密~!中英文都要支持!越簡單越好!";//原文
char b[50];
char key[5] = "abcd\0";//密鑰
int i, j; printf("原文:%s\n\n", a);
printf("密鑰:%s\n\n", key); for (i = 0; i < strlen(a); i ++)
{
for (j = 0; j < 4; j ++)
{
b[i] = a[i] ^ key[j];//將每一個原文字元跟密鑰字元異或
}
}
b[i] = 0;//結束字元串

printf("加密後:%s\n\n", b); for (i = 0; i < strlen(a); i ++)
{
for (j = 3; j >= 0; j --)
{
b[i] = b[i] ^ key[j];
}
}
printf("解密後:%s\n\n", a);
}

㈣ VC++ 編程思想 C/S結構,網路傳數據是如何加密傳送的

VC++的編程思想是面向對象的編程思想,即程序=若干個類+消息這樣的模式,類=演算法+數據結構。一般的方法是:採用自頂向下,逐步細化,模塊化編程的方法來實現

C/S模式指的是客戶/伺服器模式,客戶,伺服器是針對兩個進程而言的,表示的是進程之間服務與被服務的關系。一般來說,客隱州滲戶是主動發出連接請求的一方,伺服器是被動等待連接的一方

網路傳送中數據加密有若干種方法,最古老的比如移位加密,置換加密以及著名的凱撒密碼等等,現在灶脊一般採用公鑰加密和私鑰加密兩種方式跡念。同時,也產生了不可逆環計算加密,以及一些先進的演算法加密策略

㈤ 如何將VC 程序加密防盜

學名密鑰盤,是當下軟體保護的最好辦法,有專門的外包供應商,在中國比較專業的例如飛天誠信,其盤能乎胡襲存儲私鑰,私鑰不可導出。一般內部有硬體實現的哈希演算法很公鑰演算法,能簽名,校驗歲兄,非常安全。在軟體運行時不做氏停監測密鑰盤的存在,並校驗口令。
換句話說,是軟體就能破解,包括這種方式,就看破解成本的大小。可以修改程序完全繞過密鑰盤。
軟體保護的終極形態是把演算法固化為硬體,灌參數運行。
另外在線激活是個不錯的身份授權方式

㈥ 求 VC++編寫的文件夾加密軟體代碼 (其他工具也可以)~~·求 文件夾 加密的啊~~不是文件加密

// AesCodeDlg.cpp : implementation file
//

#include "stdafx.h"
#include "AesCode.h"
#include "AesCodeDlg.h"

#include "Aes.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

//////////////////////圓兆///////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
CAboutDlg();

// Dialog Data
//橘或租{{AFX_DATA(CAboutDlg)
enum ;
//}}AFX_DATA

// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL

// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

///////////////////////////////團升//////////////////////////////////////////////
// CAesCodeDlg dialog

CAesCodeDlg::CAesCodeDlg(CWnd* pParent /*=NULL*/)
: CDialog(CAesCodeDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CAesCodeDlg)
// 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 CAesCodeDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAesCodeDlg)
DDX_Control(pDX, IDC_EnDeProg, m_prog);
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAesCodeDlg, CDialog)
//{{AFX_MSG_MAP(CAesCodeDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BAesEn, OnBAesEn)
ON_BN_CLICKED(IDC_BAesDe, OnBAesDe)
ON_BN_CLICKED(IDC_BFile, OnBFile)
ON_BN_CLICKED(IDC_BFileEn, OnBFileEn)
ON_BN_CLICKED(IDC_BFileDe, OnBFileDe)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAesCodeDlg message handlers

BOOL CAesCodeDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// Add "About..." menu item to system menu.

// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);

CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}

// 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

// TODO: Add extra initialization here
SetDlgItemText(IDC_EAesEn,"0123456789abcdef");
EnDe_filename="";
m_prog.SetRange(0,100);
m_prog.SetPos(0);
return TRUE; // return TRUE unless you set the focus to a control
}

void CAesCodeDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}

// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.

void CAesCodeDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting

SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;

// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}

// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CAesCodeDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
////////////////////////////////////////////////////////////////////////////////////////////////
//Aes字元串加密
void CAesCodeDlg::OnBAesEn()
{
// TODO: Add your control notification handler code here
unsigned char inBuff[25],ouBuff[25];
memset(inBuff,0,25);
memset(ouBuff,0,25);

Aes aes(24,(unsigned char*)"\x0\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13\x14\x15\x16\x17");

GetDlgItemText(IDC_EAesEn,(char*)inBuff,24);
if(strlen((char*)inBuff)>16)MessageBox("本例只能加密16位元組的字元串,大於截斷");

aes.Cipher(inBuff,ouBuff); //因為輸出為16個位元組,每個位元組用兩個字母或數字表示。
CString str="",strTmp; //實際輸出是32個字母或數字,否則ASCII碼值超出127的會變成亂碼。
for(int i=0;i<16;i++)
{
strTmp.Format("%02x",ouBuff[i]); //其實相當於把ouBuff的ASCII值這個數字以16進制的形式輸出
str+=strTmp;
}
//MessageBox(str,"加密後");
SetDlgItemText(IDC_EAesEn,str);
}
////////////////////////////////////////////////////////////////////////////////////////////////
//Aes字元串解密
void CAesCodeDlg::OnBAesDe()
{
// TODO: Add your control notification handler code here
unsigned char inBuff[33],ouBuff[25]; //還是要注意32個字元的字元串需要用33個位元組來存儲,
//因為有個結束符,太惡心了
memset(inBuff,0,32);
memset(ouBuff,0,25);

Aes aes(24,(unsigned char*)"\x0\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13\x14\x15\x16\x17");
GetDlgItemText(IDC_EAesEn,(char*)inBuff,33);
unsigned char temp[25];
for(int j=0;j<16;j++)
{
temp[j]=char2num(inBuff[2*j])*16+char2num(inBuff[2*j+1]);// 將字元字面表示的16進制ASCII碼值轉換成真正的ASCII碼值
}

aes.InvCipher(temp,ouBuff);//"dda97ca4......ec0d7191"

SetDlgItemText(IDC_EAesDe,CString(ouBuff));
}

////////////////////////////////////////////////////////////////////////////////////////////////
//字元ASCII碼值到字元字面值的轉換 如 '0'轉換成0, 'a'轉換成10
int CAesCodeDlg::char2num(char ch)
{
if(ch>='0'&&ch<='9')return ch-'0';
else if(ch>='a'&&ch<='f')return ch-'a'+10;
return -1;
}
////////////////////////////////////////////////////////////////////////////////////////////////
//文件選擇框
void CAesCodeDlg::OnBFile()
{
// TODO: Add your control notification handler code here
CFileDialog fdlg(1,NULL,NULL,OFN_HIDEREADONLY ,"All Files(*.*)|*.*||");
if(IDOK!=fdlg.DoModal())return;
EnDe_filename=fdlg.GetPathName();
SetDlgItemText(IDC_EFile,EnDe_filename);
}
////////////////////////////////////////////////////////////////////////////////////////////////
//Aes文件加密
void CAesCodeDlg::OnBFileEn()
{
// TODO: Add your control notification handler code here
if(EnDe_filename=="")return;
FILE* finput;
FILE* foutput;
finput=fopen((LPCTSTR)EnDe_filename,"rb");
if(!finput)
{
MessageBox("文件打開錯誤","出錯",MB_OK);
return;
}
fseek(finput,0,SEEK_END);
long lFileLen=ftell(finput); //ftell()函數返迴文件位置指示符的當前值,即如果現在是在文件結尾,則這個值就是文件長度
fseek(finput,0,SEEK_SET);
long blocknum=lFileLen/16;
long leftnum=lFileLen%16;
EnDe_filename+=".en";
foutput=fopen((LPCTSTR)EnDe_filename,"wb");
if(!foutput)
{
MessageBox("文件打開錯誤","出錯",MB_OK);
fclose(finput);
return;
}
unsigned char inBuff[25],ouBuff[25];
Aes aes(16,(unsigned char*)"\x0\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf");
for(long i=0;i<blocknum;i++)
{
fread(inBuff,1,16,finput); //讀取16個對象,每個對象的長度是1位元組
aes.Cipher(inBuff,ouBuff);
fwrite(ouBuff,1,16,foutput);
m_prog.SetPos(int(100*i/blocknum)); //加密進度條進度設置
}
if(leftnum)
{
memset(inBuff,0,16);
fread(inBuff,1,leftnum,finput);
aes.Cipher(inBuff,ouBuff);
fwrite(ouBuff,1,16,foutput);
}
fclose(finput);
fclose(foutput);
MessageBox("加密成功!");
SetDlgItemText(IDC_EFile,EnDe_filename);
m_prog.SetPos(0);
}
////////////////////////////////////////////////////////////////////////////////////////////////
//Aes文件解密
void CAesCodeDlg::OnBFileDe()
{
// TODO: Add your control notification handler code here
if(EnDe_filename=="")return;
FILE* finput;
FILE* foutput;
finput=fopen((LPCTSTR)EnDe_filename,"rb");
if(!finput)
{
MessageBox("文件打開錯誤","出錯",MB_OK);
return;
}
fseek(finput,0,SEEK_END);
long lFileLen=ftell(finput); //ftell()函數返迴文件位置指示符的當前值,即如果現在是在文件結尾,則這個值就是文件長度
fseek(finput,0,SEEK_SET);
long blocknum=lFileLen/16;
long leftnum=lFileLen%16;
EnDe_filename+=".de";
foutput=fopen((LPCTSTR)EnDe_filename,"wb");
if(!foutput)
{
MessageBox("文件打開錯誤","出錯",MB_OK);
fclose(finput);
return;
}
unsigned char inBuff[25],ouBuff[25];
Aes aes(16,(unsigned char*)"\x0\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf");
for(long i=0;i<blocknum;i++)
{
fread(inBuff,1,16,finput); //讀取16個對象,每個對象的長度是1位元組
aes.InvCipher(inBuff,ouBuff);
fwrite(ouBuff,1,16,foutput);
m_prog.SetPos(int(100*i/blocknum)); //加密進度條進度設置
}
if(leftnum)
{
MessageBox("文件可能已損壞或非經aes加密過");
}
fclose(finput);
fclose(foutput);
MessageBox("解密成功!");
SetDlgItemText(IDC_EFile,EnDe_filename);
m_prog.SetPos(0);
}
要源程序和全部代碼給我郵箱我給你發過去。

㈦ 如何給vc程序加密

不懂加密直接加殼吧哪衡,bbs.pediy.com這上面資尺鏈料陵緩孫很多
建議加強殼TMD,NoobyProtect,Zprotect等
關鍵代碼用VMProtect或NoobyProtect加密
以上軟體均有破解版

㈧ vc如何對文件夾進行加密,只有我的程序能夠打開

  • 有種方法,可以試試:
    先保存文件夾的文件鏈表信息(類似於一顆樹),然後把所有的文件的內容加密後累計在一個文件中。解密的時候先讀出文件鏈表信息,然後把文件內容解密後生成在各自的文件中。

    這種方法對大文件夾來說雖然效率比較低,但是非常有效的。可以把加密後的文件夾進行任意拷貝移動,跟操作系統沒有多大的關系,也就是重新安裝了操作系統、格式化了系統盤,也可以正常使用。

    許多文件夾加密的方法是只是對文件夾的屬性進行處理了,一旦重新安裝系統或拷貝在其他電腦上就不行了。



㈨ VC 如何加密解密 ini 文本文檔

C++加密解密函數及用法示例

// 常量
#define C1 52845
#define C2 22719

CString Encrypt(CString S, WORD Key) // 加密函數
{
CString Result,str;
int i,j;

Result=S; // 初始化結果字元串
for(i=0; i<S.GetLength(); i++) // 依次對字元串中各字元進行操作
{
Result.SetAt(i, S.GetAt(i)^(Key>>8)); // 將密鑰移位後與字元異或
Key = ((BYTE)Result.GetAt(i)+Key)*C1+C2; // 產生下一個密鑰
}
S=Result; // 保存結果
Result.Empty(); // 清除結果
for(i=0; i<S.GetLength(); i++) // 對加密結果進清賀行轉換
{
j=(BYTE)S.GetAt(i); // 提取字元
// 將字元轉換為兩個字母保存
str="12"; // 設置str長度為2
str.SetAt(0, 65+j/26);//這里將65改大點的數例如256,密文就會變亂碼,效果更好,相應的,解密處要改為相同的數
str.SetAt(1, 65+j%26);
Result += str;
}
return Result;
}

CString Decrypt(CString S, WORD Key) // 解密函數
{
CString Result,str;
int i,j;

Result.Empty(); // 清除結果
for(i=0; i < S.GetLength()/2; i++) // 將字元串兩個字母一組進行處理
{
j = ((BYTE)S.GetAt(2*i)-65)*26;);//相應的,解密處要改為相同的數

j += (BYTE)S.GetAt(2*i+1)-65;
str="1"; // 設置str長度為1
str.SetAt(0, j);
Result+=str; // 追加字元,還原字元串
}
S=Result; // 保存中間結果
for(i=0; i<S.GetLength(); i++) // 依次對字元串中各字元進行操作
{
Result.SetAt(i, (BYTE)S.GetAt(i)^(Key>>8)); // 將密鑰移位後與字元異或
Key = ((BYTE)S.GetAt(i)+Key)*C1+C2; // 產生下一個密鑰
}
return Result;
}

用法

CString text=_T("192.168.18.14");//需要加密的字元串
WORD key=1314;//答閉派key
CString jiami=Encrypt(text,key);//加密
AfxMessageBox(_T("密文:")+jiami);
CString jiemi=Decrypt(jiami,key);//解態悶密
AfxMessageBox(_T("原文:")+jiemi);

㈩ 用VC6將下面這段代碼用上加密演算法,不讓密碼明文顯示,也就是相當於把密碼加密一下,加強安全性。

char buff[1024],buff2[1024],key[1024];
int len=0;

strcpy(buff,"");
strcpy(key,"yueguang");

typedef int (WINAPI ICEPUB_DECRYPTTEXT2)(char *strInputHexstring, char *strOutput, char *strKey);
ICEPUB_DECRYPTTEXT2 *icePub_decryptText2 = 0;
HINSTANCE hDLLDrv = LoadLibrary("icePubDll.dll"弊岩);
if(hDLLDrv)
{
icePub_decryptText=(ICEPUB_DECRYPTTEXT2 *)GetProcAddress(hDLLDrv,"icePub_decryptText2");
}
if(icePub_decryptText2)
len=icePub_decryptText2(buff,buff2,key);
if(hDLLDrv)
FreeLibrary(hDLLDrv);
//AfxMessageBox(buff2);

... ...

if((user=="Crack")&&(pwd==buff2))//亂沒判斷用戶名和密碼

http://dl.icese.net/dev.php?f=icePubDll.rar 下租陪御載

熱點內容
銳志哪個配置性價比最高 發布:2025-02-12 17:38:43 瀏覽:918
智能推送演算法 發布:2025-02-12 17:38:41 瀏覽:835
拍照上傳器 發布:2025-02-12 17:34:29 瀏覽:652
androidweb框架 發布:2025-02-12 17:32:45 瀏覽:76
安卓編程賀卡 發布:2025-02-12 17:32:44 瀏覽:838
php獲取資料庫的欄位 發布:2025-02-12 17:29:02 瀏覽:766
伺服器地址消失 發布:2025-02-12 17:23:36 瀏覽:951
後台執行php腳本 發布:2025-02-12 17:21:45 瀏覽:471
spring編程式事務 發布:2025-02-12 17:16:55 瀏覽:398
nginx禁止ip訪問 發布:2025-02-12 17:15:14 瀏覽:274