Skip to content

Instantly share code, notes, and snippets.

@divyanshu013
Created September 27, 2015 19:17
Show Gist options
  • Save divyanshu013/4beb05293e1556f527b6 to your computer and use it in GitHub Desktop.
Save divyanshu013/4beb05293e1556f527b6 to your computer and use it in GitHub Desktop.
A simple program to show DES encryption in python using pyDes
from pyDes import *
from binascii import unhexlify as unhex
key = des(unhex("4C1122171220F74E"))
data = "0001010011010111010010010001001001111100100111100001101110000010"
encrypted = key.encrypt(data)
print ("Encrypted: %r" % encrypted)
decrypted = key.decrypt(encrypted)
print ("Decrypted: %r" % decrypted)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment