[PYTHON-CRYPTO] confused about state of crypto in python

Jason R. Mastaler jason-list-python-crypto at MASTALER.COM
Mon Mar 26 20:52:49 CEST 2001


Andrew Archibald <aarchiba at YAHOO.COM> writes:

> Heh.  Yes, it is daunting; the goal of this list is to solve that problem.

Glad to hear that.

> I would use amkCrypto.

Thanks for the clarification.

> Is there some convenient API doc online?  What do you think of the API?

Not that I can find, but perl Crypt modules generally implement the
Crypt::BlockCipher interface, which has the following methods:

       blocksize =item keysize =item encrypt =item decrypt

(from Crypt::Blowfish)

       blocksize
           Returns the size (in bytes) of the block cipher.

       keysize
           Returns the size (in bytes) of the key.

       new
                   my $cipher = new Crypt::Blowfish $key;

           This creates a new Crypt::Blowfish BlockCipher object,
           using $key, where $key is a key of `keysize()' bytes.

       encrypt
                   my $cipher = new Crypt::Blowfish $key;
                   my $ciphertext = $cipher->encrypt($plaintext);

           This function encrypts $plaintext and returns the
           $ciphertext where $plaintext and $ciphertext should be
           of `blocksize()' bytes.

       decrypt
                   my $cipher = new Crypt::Blowfish $key;
                   my $plaintext = $cipher->decrypt($ciphertext);

           This function decrypts $ciphertext and returns the
           $plaintext where $plaintext and $ciphertext should be
           of `blocksize()' bytes.

EXAMPLE
               my $key = pack("H16", "0123456789ABCDEF");
               my $cipher = new Crypt::Blowfish $key;
               my $ciphertext = $cipher->encrypt("plaintex");  # NB - 8 bytes
               print unpack("H16", $ciphertext), "\n";

--
Tired of receiving SPAM/UCE?  See <http://jason.mastaler.com/tms>





More information about the python-crypto mailing list