VC 加密 解密

2021-10-01 17:48:02 字數 1234 閱讀 5386

標頭檔案申明(cencrypt.h):

#ifndef encrypt_head_file

#define encrypt_head_file

#pragma once

//巨集定義

#define xor_times 8 //加密倍數

#define max_source_len 64 //最大長度

#define max_encrypt_len (max_source_len*xor_times) //最大長度

#define len_md5 33 //加密長度

//加密元件

class cencrypt

;#endif

原始碼實現(cencrypt.cpp):

#include "stdafx.h"

#include "cencrypt.h"

#include "cdesencrypt.h"

#include "cmd5encrypt.h"

//加密對映

const byte g_cbencryptmap[256]=

;//解密對映

const byte g_cbdecryptmap[256]=

;//建構函式

cencrypt::cencrypt()

//析構函式

cencrypt::~cencrypt()

//生成密文

bool cencrypt::md5encrypt(lpctstr pszsourcedata, tchar szmd5result[len_md5])

//生成密文

bool cencrypt::xorencrypt(lpctstr pszsourcedata, lptstr pszencrypdata, word wmaxcount)

//設定結果

pszsourcedata[nlength]=0;

return true;

}//des加密

bool cencrypt::desencrypt(lpctstr pszsourcedata,lptstr pszencrypdata)

//des解密

bool cencrypt::desdecrypt(lpctstr pszencrypdata,lptstr pszsourcedata)

des vue 加密解密 DES加密 解密

外掛程式描述 des data encryption standard 是發明最早的最廣泛使用的分組對稱加密演算法。des演算法簡介 des data encryption standard 是發明最早的最廣泛使用的分組對稱加密演算法。des演算法的入口引數有三個 key data mode。其中k...

檔案加密解密 URl引數加密解密

sliverlight 加密解密 public static class encryption endregion region silverlight密碼解密 解密資料 加密後的字串 加密前的字串 public static string decrypt string input endregio...

加密解密 替換加解密

加密解密 替換加解密 按一定規則重新替換明文的字元生成密文。可以有多種替換方式。include void encrypt char strdata,int ncode printf original s n strdata p strdata for i 0 i nlen i printf enco...