當前位置:首頁 » 編程語言 » pythondes解密

pythondes解密

發布時間: 2022-08-24 09:49:30

『壹』 跪求大佬python DES加密(Crypto包)

python的des實現有pyDes這個庫,不知道你是不是要這個,下載方式:

pipinstallpyDes

『貳』 python代碼轉換java代碼,由於本人不會python,所以求指教,下面是一小段!

importCrypto.Cipher.DES;
importhashlib.md5;
importstaticpython.lang.System;

publicclassTest{
publicstaticvoidmain(String[]args)
{
Stringkey="x32x8DxD2x0BxC3xE6xD2xCF";
DEScrypto=newDES(key,DES.MODE_ECB);
Stringdata=open('a.txt','rb').read();
Object[]data_decrypted=crypto.decrypt(data).rstrip("");
/**這個,後面的有點不兼容。其實不知道DES、md5的源碼也改不了,而且java又不能直接調用其中的python代碼,除非你寫相應的java代碼和他們映射**/
}
}

『叄』 用python將內容寫入文件,寫入數據出現重復多次

是w,我這個是先從一個文件讀出來,進行解密,然後將結果寫入新文檔中,des解密出來的數據用print輸出都是正確地,寫入文件中就出現重復多行

『肆』 求一個DES 演算法 PHP python 通用 PHP進行加密 python解密

用hash唄。
import hashlib

a = "a test string"
print hashlib.md5(a).hexdigest()
print hashlib.sha1(a).hexdigest()
print hashlib.sha224(a).hexdigest()
print hashlib.sha256(a).hexdigest()
print hashlib.sha384(a).hexdigest()
print hashlib.sha512(a).hexdigest()

針對str類型的。
加密的話,可以對最後得出的hash值再處理即可。比如左移,右移,某2位替換,某位加幾等等即可。
解密直接用逆序就可以了。

『伍』 有python下DES加密解密模塊嗎

一個例子給你參考;
>>> import win32com.client
>>> EncryptedData = win32com.client.Dispatch('CAPICOM.EncryptedData')
>>> EncryptedData.Algorithm.KeyLength = 5
>>> EncryptedData.Algorithm.Name = 2
>>> EncryptedData.SetSecret('mypass')
>>> EncryptedData.Content = 'Hello world'
>>> s = EncryptedData.Encrypt()
>>> s
u'\r\nk6mhbmNo7AQQPzxLV17fVCCYUGLD+\r\nX4Vw\r\n'
>>> EncryptedData.Decrypt(s)
>>> EncryptedData.Content
u'Hello world'

『陸』 Python編程實現加密解密讀取文件

對Python加密時可能會有兩種形式,一種是對Python轉成的exe進行保護,另一種是直接對.py或者.pyc文件進行保護,下面將列舉兩種形式的保護流程。

1、對python轉exe加殼

下載最新版VirboxProtector加殼工具,使用加殼工具直接對demo.exe進行加殼操作

2、對.py/.pyc加密

第一步,使用加殼工具對python安裝目錄下的python.exe進行加殼,將python.exe拖入到加殼工具VirboxProtector中,配置後直接點擊加殼。

第二步,對.py/.pyc進行加密,使用DSProtector對.py/.pyc進行保護。

安全技術:

l虛擬機外殼:精銳5的外殼保護工具,創新性的引入了預分析和自動優化引擎,有效的解決了虛擬化保護代碼時的安全性和性能平衡問題。

l碎片代碼執行:利用自身成熟的外殼中的代碼提取技術,抽取大量、大段代碼,加密混淆後在安全環境中執行,最大程度上減少加密鎖底層技術和功能的依賴,同時大量大段地移植又保證了更高的安全性。

lVirbox加密編譯引擎:集編譯、混淆等安全功能於一身,由於在編譯階段介入,可優化空間是普遍虛擬化技術無法比擬的,對代碼、變數的混淆程度也有了根本的提升。

l反黑引擎:內置R0級核心態反黑引擎,基於黑客行為特徵 的(反黑資料庫)反制手段。精準打擊調試、注入、內存修改等黑客行為,由被動挨打到主動防護。

加密效果:

加密之前

以pyinstall 的打包方式為例,使用pyinstxtractor.py文件對log_322.exe進行反編譯,執行後會生成log_322.exe_extracted文件夾,文件夾內會生成pyc文件。

成功之後會在同目錄下生成一個文件夾

『柒』 如何使用Python進行Rijndael方式的加密解密

Rijndael,在高級加密標准(AES)中使用的基本密碼演算法。
概述 (美國)國家標准技術研究所(NIST)選擇Rijndael作為美國政府加密標准(AES)的加密演算法,AES取代早期的數據加密標准(DES)。Rijndael由比利時計算機科學家Vincent Rijmen和Joan Daemen開發,它可以使用128位,192位或者256位的密鑰長度,使得它比56位的DES更健壯可靠。Rijndael也有一個非常小的版本(52位),合適用在蜂窩電話、個人數字處理器(PDA)和其他的小設備上。
近似讀音:Rijn [rain] dael [del] (萊恩戴爾) Rijn 來源 Rhine [萊茵河]的荷蘭語(Dutch)發音。
dael 是常用的人名 這詞是兩個科學家的名字各出一段拼成的。
Rijndael.h
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <exception>
#include <string.h>
using namespace std;
class CRijndael
{
public:
enum { ECB=0, CBC=1, CFB=2 };
private:
enum { DEFAULT_BLOCK_SIZE=16 };
enum { MAX_BLOCK_SIZE=32, MAX_ROUNDS=14, MAX_KC=8, MAX_BC=8 };

static int Mul(int a, int b)
{
return (a != 0 && b != 0) ? sm_alog[(sm_log[a & 0xFF] + sm_log[b & 0xFF]) % 255] : 0;
}
static int Mul4(int a, char b[])
{
if(a == 0)
return 0;
a = sm_log[a & 0xFF];
int a0 = (b[0] != 0) ? sm_alog[(a + sm_log[b[0] & 0xFF]) % 255] & 0xFF : 0;
int a1 = (b[1] != 0) ? sm_alog[(a + sm_log[b[1] & 0xFF]) % 255] & 0xFF : 0;
int a2 = (b[2] != 0) ? sm_alog[(a + sm_log[b[2] & 0xFF]) % 255] & 0xFF : 0;
int a3 = (b[3] != 0) ? sm_alog[(a + sm_log[b[3] & 0xFF]) % 255] & 0xFF : 0;
return a0 << 24 | a1 << 16 | a2 << 8 | a3;
}
public:
CRijndael();
virtual ~CRijndael();

void MakeKey(char const* key, char const* chain,
int keylength=DEFAULT_BLOCK_SIZE, int blockSize=DEFAULT_BLOCK_SIZE);
private:
void Xor(char* buff, char const* chain)
{
if(false==m_bKeyInit)
throw exception(sm_szErrorMsg1);
for(int i=0; i<m_blockSize; i++)
*(buff++) ^= *(chain++);
}
void DefEncryptBlock(char const* in, char* result);
void DefDecryptBlock(char const* in, char* result);
public:

void EncryptBlock(char const* in, char* result);
void DecryptBlock(char const* in, char* result);
void Encrypt(char const* in, char* result, size_t n, int iMode=ECB);

void Decrypt(char const* in, char* result, size_t n, int iMode=ECB);
int GetKeyLength()
{
if(false==m_bKeyInit)
throw exception(sm_szErrorMsg1);
return m_keylength;
}
int GetBlockSize()
{
if(false==m_bKeyInit)
throw exception(sm_szErrorMsg1);
return m_blockSize;
}
int GetRounds()
{
if(false==m_bKeyInit)
throw exception(sm_szErrorMsg1);
return m_iROUNDS;
}
void ResetChain()
{
memcpy(m_chain, m_chain0, m_blockSize);
}
public:
static char const* sm_chain0;
private:
static const int sm_alog[256];
static const int sm_log[256];
static const char sm_S[256];
static const char sm_Si[256];
static const int sm_T1[256];
static const int sm_T2[256];
static const int sm_T3[256];
static const int sm_T4[256];
static const int sm_T5[256];
static const int sm_T6[256];
static const int sm_T7[256];
static const int sm_T8[256];
static const int sm_U1[256];
static const int sm_U2[256];
static const int sm_U3[256];
static const int sm_U4[256];
static const char sm_rcon[30];
static const int sm_shifts[3][4][2];
static char const* sm_szErrorMsg1;
static char const* sm_szErrorMsg2;
bool m_bKeyInit;
int m_Ke[MAX_ROUNDS+1][MAX_BC];
int m_Kd[MAX_ROUNDS+1][MAX_BC];
int m_keylength;
int m_blockSize;
int m_iROUNDS;
char m_chain0[MAX_BLOCK_SIZE];
char m_chain[MAX_BLOCK_SIZE];
int tk[MAX_KC];
int a[MAX_BC];
int t[MAX_BC];
};

『捌』 用Python如何 實現DES演算法

原創的嘛,自己寫唄。DES安全性沒其他演算法那麼高,應該不會很復雜、

『玖』 python 編程 有了加密程序,怎麼寫解密程序

對 Python 加密時可能會有兩種形式,一種是對Python轉成的exe進行保護,另一種是直接對.py或者.pyc文件進行保護,下面將列舉兩種形式的保護流程。
1、 對 python轉exe加殼
下載最新版Virbox Protector加殼工具,使用加殼工具直接對demo.exe進行加殼操作
2、對.py/.pyc加密
第一步,使用加殼工具對 python 安裝目錄下的 python.exe 進行加殼,將 python.exe 拖入到加殼工具 VirboxProtector 中,配置後直接點擊加殼。
第二步,對.py/.pyc 進行加密,使用 DSProtector 對.py/.pyc 進行保護。

『拾』 密碼學——DES解密問題

你這問題比較耗時間,不過不難,給你個網址你自己分析分析就出來了。http://en.wikipedia.org/wiki/Data_Encryption_Standard,這里是演算法基本描述。http://en.wikipedia.org/wiki/DES_supplementary_material,這里是各種變換的影射關系,你按照這個圖里的影射變換就找到某一個bit怎麼來的了。

熱點內容
上網的賬號密碼從哪裡找 發布:2024-06-02 08:57:55 瀏覽:182
js腳本編輯 發布:2024-06-02 08:57:31 瀏覽:156
阿里雲伺服器打包怎麼設置 發布:2024-06-02 08:49:26 瀏覽:509
oracle資料庫連接伺服器 發布:2024-06-02 08:49:17 瀏覽:535
linux上一級目錄 發布:2024-06-02 08:29:37 瀏覽:730
怎麼獲取串口伺服器的ip 發布:2024-06-02 08:29:36 瀏覽:961
如何選擇卡車配置 發布:2024-06-02 08:28:52 瀏覽:971
舒心解壓丸 發布:2024-06-02 08:28:48 瀏覽:39
蘋果和安卓系統哪個更隱私 發布:2024-06-02 08:28:46 瀏覽:282
文件夾遞歸刪除 發布:2024-06-02 08:26:06 瀏覽:663