有名なdes暗号化アルゴリズムを実装および実験するための簡単なPythonパッケージ。それは、古典的な(DESの教科書の説明からのデフォルト設定)と非古典的なDESの両方を実装します。雪崩効果とパッケージを使用した弱いキーを示す非常に具体的な実装については、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上に構築されています。したがって、Pythonが初めての場合は、この素晴らしいWebサイトにアクセスしてください。
問題の下でGitHubで検索してバグがまだ報告されていないことを確認してください。バグに対処するオープンな問題が見つからない場合は、新しい問題を開きます。
たとえば、詳細な情報は問題を理解するのに非常に役立ちます。
プルリクエストはいつでも大歓迎です。
git commit前にpython -m unittestを実行してコードをテストしてください。Syntax VMMのフォローファーストは主要であり、後方互換の変更ではないことを意味します。 2番目はマイナーであり、逆方向の互換性のある変更を意味します。 3番目はパッチであり、小さな後方互換の変更を意味します。
バージョンの真実のソースのマニュアルの場所はsetup.pyにあります