حزمة Python بسيطة لاستخدامها لتنفيذ وتجربة خوارزمية تشفير DES الشهيرة. وهو ينفذ كلا من الإعدادات الكلاسيكية (الإعدادات الافتراضية من وصف الكتاب المدرسي لـ DES) و DES غير كلاسيكي. تحقق من تطبيق DES للحصول على تطبيق محدد للغاية يوضح تأثير الانهيار والمفاتيح الضعيفة باستخدام الحزمة.
هناك عدد غير قليل من حزم DES لـ Python ، لكن أيا منها لا يقدم مثل هذه المرونة العالية لتنفيذ نسخة غير كلاسيكية من DES. تهدف هذه الحزمة على وجه التحديد لتجربة الفائقة المختلفة التي يمكن تعديلها أثناء تنفيذ DES.
help(<function_name>) في مترجم Python.المكافأة : يمكن أن تكون هذه الحزمة منفردًا للحياة لدورة أمان الشبكة CSE 537- التي يتم تدريسها في IIT (BHU).
*قد يتطلب تعديل بعض هذه الأشياء تغيير رمز المصدر اعتبارًا من الإصدار الحالي
قم بتشغيل الأمر التالي في موجه المحطة/الأوامر-
$ 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 بموجب القضايا. إذا لم تتمكن من العثور على مشكلة مفتوحة تتناول الخطأ ، فتشكل مشكلة جديدة.
المعلومات التفصيلية مفيدة للغاية لفهم مشكلة ، على سبيل المثال-
طلبات السحب دائما موضع ترحيب.
python -m unittest لاختبار الرمز الخاص بك قبل git commit .يتبع Syntax vM.MP أولاً هو التخصص ولا يعني تغييرات متوافقة مع الوراء. الثاني هو بسيط ويعني التغييرات المتوافقة مع الورق. ثالثًا هو التصحيح ويعني تغييرات صغيرة متوافقة مع الخلف.
المكان اليدوي لمصدر الحقيقة للإصدار هو في setup.py