유명한 DES 암호화 알고리즘을 구현하고 실험하기 위해 Python 패키지를 사용하는 간단합니다. 클래식 (DES의 교과서 설명에서 기본 설정)과 비전자 DES를 모두 구현합니다. Avalanche 효과와 패키지를 사용하여 약한 키를 보여주는 매우 구체적인 구현은 DES 앱을 확인하십시오.
Python 용 DES 패키지는 몇 개 있지만 비전자 버전의 DES를 구현할 수있는 유연성을 제공하지 않습니다. 이 패키지는 DES를 구현하는 동안 조정할 수있는 다양한 과다 램터를 실험하는 것을 목표로합니다.
help(<function_name>) 을 입력하십시오.보너스 :이 패키지는 IIT (BHU)에서 가르치는 CSE 537- 네트워크 보안 과정의 구명가가 될 수 있습니다.
*이들 중 일부를 조정하려면 현재 릴리스시 소스 코드를 변경해야 할 수도 있습니다.
터미널/명령 프롬프트에서 다음 명령을 실행하십시오.
$ pip install DESfiddle
참고 :
pip설치하지 않은 경우 다음 단계를 따르십시오.
# Importing
import DESfiddle.utils as dfu
# Usage
permutation_arr = dfu.generate_permutation(64)
# Importing
from DESfiddle.utils import *
# or just specify the function name you wanna import
# Usage
permutation_arr = generate_permutation(64)
from DESfiddle.utils import *
# Inputs in binary setting
plaintext = "0101010101010101010101010101010101010101010101010101010101010101"
key = "1111111111111111111111111111111100000000000000000000000000000000"
# Settings
nor = 16
halfwidth = 32
hamming_dist = 1
# Hamming the plaintext in binary mode
ref_pt_arr = preprocess_plaintext(plaintext, halfwidth)
pt_arr = preprocess_plaintext(plaintext, halfwidth, hamming_dist)
key = preprocess_key(key, halfwidth)
rkb,rkh = generate_round_keys(key,nor, halfwidth)
ref_ciphertext, ref_round_ciphertexts = encrypt(ref_pt_arr, rkb, nor, halfwidth)
_, round_ciphertexts = encrypt(pt_arr, rkb, nor, halfwidth)
diff = calc_diff(ref_round_ciphertexts, round_ciphertexts)
# Hamming the key in binary mode
pt_arr = preprocess_plaintext(plaintext, halfwidth)
ref_key = preprocess_key(key,halfwidth)
key = preprocess_key(key, halfwidth, hamming_dist)
ref_rkb, ref_rkh = generate_round_keys(ref_key, nor, halfwidth)
rkb,_ = generate_round_keys(key, nor, halfwidth)
ref_ciphertext, ref_round_ciphertexts = encrypt(pt_arr, ref_rkb, nor, halfwidth)
_, round_ciphertexts = encrypt(pt_arr, rkb, nor, halfwidth)
diff = calc_diff(ref_round_ciphertexts, round_ciphertexts)
from DESfiddle.utils import *
# Inputs in ASCII setting
plaintext = "This is so cool"
key = "Yesss"
# Settings
nor = 16
halfwidth = 32
hamming_dist = 1
# Preprocessing when input in ASCII
plaintext = txt_to_hex(plaintext)
plaintext = hex_to_bin(plaintext)
key = txt_to_hex(key)
key = hex_to_bin(key)
# Hamming the plaintext in binary mode
ref_pt_arr = preprocess_plaintext(plaintext, halfwidth)
pt_arr = preprocess_plaintext(plaintext, halfwidth, hamming_dist)
key = preprocess_key(key, halfwidth)
rkb,rkh = generate_round_keys(key,nor, halfwidth)
ref_ciphertext, ref_round_ciphertexts = encrypt(ref_pt_arr, rkb, nor, halfwidth)
_, round_ciphertexts = encrypt(pt_arr, rkb, nor, halfwidth)
diff = calc_diff(ref_round_ciphertexts, round_ciphertexts)
# Hamming the key in binary mode
pt_arr = preprocess_plaintext(plaintext, halfwidth)
ref_key = preprocess_key(key,halfwidth)
key = preprocess_key(key, halfwidth, hamming_dist)
ref_rkb, ref_rkh = generate_round_keys(ref_key, nor, halfwidth)
rkb,_ = generate_round_keys(key, nor, halfwidth)
ref_ciphertext, ref_round_ciphertexts = encrypt(pt_arr, ref_rkb, nor, halfwidth)
_, round_ciphertexts = encrypt(pt_arr, rkb, nor, halfwidth)
diff = calc_diff(ref_round_ciphertexts, round_ciphertexts)
시간을내어 공헌 해 주셔서 감사합니다!
다음은 Desfiddle에 기여하기위한 일련의 지침입니다. 이들은 규칙이 아닌 단지 지침이므로 최선의 판단을 사용하고 풀 요청 에서이 문서의 변경 사항을 자유롭게 제안하십시오.
Desfiddle은 파이썬 위에 만들어졌습니다. 따라서 Python을 처음 사용한다면이 훌륭한 웹 사이트로 가십시오.
문제에서 Github에서 검색하여 버그가 아직보고되지 않았는지 확인하십시오. 버그를 다루는 열린 문제를 찾을 수 없다면 새 문제를 엽니 다.
자세한 정보는 문제를 이해하는 데 매우 도움이됩니다.
풀 요청은 항상 환영합니다.
git commit 전에 python -m unittest 실행하여 코드를 테스트하십시오.Syntax vm.mp를 따르는 첫 번째는 주요한 것이며 거꾸로 호환되는 변경 사항이 아닙니다. 두 번째는 사소하며 거꾸로 호환되는 변경을 의미합니다. 셋째는 패치이며 작은 거꾸로 호환되는 변화를 의미합니다.
버전에 대한 진실의 수동 장소는 setup.py 에 있습니다.