91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 0.01M
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-23
  • 語言: 其他
  • 標簽: 其他??

資源簡介

Qt異或實現文件加解密.rar

資源截圖

代碼片段和文件信息

#include?“xor.h“
#include?

#include?
#include?
#include?
#include?
#include?
#include?

namespace?Crypt
{
using?std::min;
using?std::bind;
using?std::function;
using?std::remove_cv;
using?std::unique_ptr;
using?std::remove_pointer;

using?namespace?std::placeholders;

typedef?struct?{
UCHAR?Secret;

LPBYTE?Sig;
DWORD?SizeOfSig;
}?KEY?*PKEY;

template
BOOL?IsEmptyString(_Ty?&&psz)?/*?_NOEXCEPT?*/?{?return?!psz?||?!*psz;?}

template
struct?Ptr?:?public?unique_ptr?::type?*)?>?>
{
template?Ptr(_Pty?&&_Ptr)
:?unique_ptr?::type?*)?>?>(
std::forward(_Ptr)
[](typename?remove_cv::type?*h)?{?if?(h?&&?h?!=?INVALID_HANDLE_VALUE)?CloseHandle(h);?})
{
}
};

namespace?Impl /*?內部實現,不要直接調用?*/
{
BOOL?IsEncoded(_In_?HANDLE?h?_In_?DWORD?SizeOfFile?_In_?__readonly?KEY?*Key)
{
if?(Key->SizeOfSig?>?SizeOfFile)
return?FALSE;

if?(SetFilePointer(h?SizeOfFile?-?Key->SizeOfSig?NULL?FILE_BEGIN)?==
INVALID_SET_FILE_POINTER)
return?FALSE;

unique_ptr>
p((LPBYTE)HeapAlloc(GetProcessHeap()?HEAP_ZERO_MEMORY?Key->SizeOfSig)
bind(HeapFree?GetProcessHeap()?IGNORE?_1));
if?(!p)
{
SetLastError(ERROR_OUTOFMEMORY);
return?FALSE;
}

DWORD?Readed?=?0;
if?(!ReadFile(h?p.get()?Key->SizeOfSig?&Readed?NULL)?||
Key->SizeOfSig?!=?Readed)
return?FALSE;

SetLastError(ERROR_SUCCESS);
return?!memcmp(p.get()?Key->Sig?Key->SizeOfSig);
}

//?注:
// 此函數只承諾滿足基本異常安全等級。若函數失敗,文件的其中一部分可能已被修改。
template
BOOL?Xor(_In_?HANDLE?h?_In_?DWORD?SizeOfFile?_In_?__readonly?KEY?*Key?_Fn?&&_Func)
{
DWORD?Readed?=?0;
BYTE?Buffer[BUFSIZ]?=?{?0?};
while?(SizeOfFile)
{
if?(!ReadFile(h?Buffer?min((DWORD)sizeof(Buffer)?SizeOfFile)?&Readed?NULL))
return?FALSE;

SizeOfFile?-=?Readed;

for?(DWORD?i?=?0;?i? Buffer[i]?^=?Key->Secret;

if?(SetFilePointer(h?0?-?Readed?NULL?FILE_CURRENT)?==?INVALID_SET_FILE_POINTER)
return?FALSE;

DWORD?dw?=?0;
while?(Readed)
{
if?(!WriteFile(h?Buffer?Readed?&dw?NULL))
return?FALSE;
Readed?-=?dw;
}
}

return?_Func(h?Key->Secret?Key->Sig?Key->SizeOfSig);
}
}

/*
IsEncoded
檢查一個文件是否已被使用?KEY?對象編碼過。

參數:
NameOfFile,被檢查的文件。
Key,測試在文件上的?KEY?對象。

返回值:
已被編碼返回非零值,否則返回零。

注:
若函數返回零且?GetLastError?不為?ERROR_SUCCESS?表示檢查失敗,而非文件未被編碼。
*/
BOOL?IsEncoded(_In_z_?LPCTSTR?NameOfFile?_In_?__readonly?KEY?*Key?)
{
if?(IsEmptyString(?NameOfFile?)?||?!Key?)
{
SetLastError(ERROR_INVALID_PARAMETER);
return?FALSE;
}

Ptr

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????5758??2019-01-02?11:53??異或實現文件加解密\main.cpp

?????文件???????8078??2019-01-03?12:00??異或實現文件加解密\Qt中的實現.cpp

?????文件????????145??2018-12-27?15:59??異或實現文件加解密\xor.cpp

?????文件????????256??2018-12-27?15:59??異或實現文件加解密\xor.h

?????文件?????????63??2018-12-27?15:59??異或實現文件加解密\xor.qrc

?????文件????????770??2018-12-27?15:59??異或實現文件加解密\xor.ui

?????文件??????10700??2019-01-02?09:44??異或實現文件加解密\Xor.vcxproj

?????文件???????2643??2018-12-27?15:59??異或實現文件加解密\Xor.vcxproj.filters

?????文件????????581??2018-12-27?15:59??異或實現文件加解密\Xor.vcxproj.user

?????目錄??????????0??2019-01-03?11:46??異或實現文件加解密

-----------?---------??----------?-----??----

????????????????28994????????????????????10


評論

共有 條評論