[go: up one dir, main page]

Skip to content

Encryption software that emulates the german enigma machine.

Notifications You must be signed in to change notification settings

edoermini/pygma-enigma

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 

Repository files navigation

pygma-enigma

Encryption software that emulates the german enigma machine.

User guide

Setup your machine

  • Rotors

    from pygma.rotor import Rotor

    r1 = Rotor("asdfghjklzxcvbnmqwertyuiop", 9)
    r2 = Rotor("qawsedrftgyhujikolpzxcvbnm", 24)
    r3 = Rotor("zxcvbnmasdfghjklqwertyuiop", 2)

    The Rotor function sets the rotor and it requires 2 arguments, the first the alphabet that will correspond to the rotor, and the second the rotor starting point.

  • Reflector

    from pygma.reflector import Reflector

    reflector = Reflector("adsfgjhklzcxvbmnqewrtuyiop", 12)

    The Reflector function sets the reflector and similarly to the Rotor function it requires 2 arguments, the first the alphabet that will correspond to the reflector, and the second the reflector starting point.

  • Plug Board

    from pygma.plugboard import PlugBoard

    pb = PlugBoard("as,de,fr")

    The PlugBoard function sets the exchange between two letters it requires 1 arguments that corresponds to the groups of letters to be exchanged.

    Example:
    PlugBoard("as,de,fr") means that letter a must be exchanged with s and vice versa, as well as for d and e letters, and for f and r letters.

Start Encrypting and Decrypting

  • Set Encrypter and Decrypter

    from pygma.machine import Machine

    e = Machine([r1, r2, r3], reflector, pb)

    The Machine function sets the machine with the declared elements.

  • Encrypt and decrypt

    e.enc_dec("hello!")
    'krcpy!'
    e.enc_dec("krcpy!")
    'hello!'

    The enc_dec function encrypts and decrypts given words with the configuration previously set.

Releases

No releases published

Packages

No packages published

Languages