[pycrypto] BouncyCastle to PyCrypto translation

joshua masiko joshuamasiko at gmail.com
Tue Feb 26 11:41:11 PST 2013


I'm trying to translate some Java code that uses BouncyCastle  to  Python
using PyCrypto.
Does any one know what the equivalent code in python would be for the
snippet below?


public String getMAC(byte[] macData, byte[] macKey)
    byte[] macBytes = new byte[4];
    CbcBlockCipherMac macCipher = new CbcBlockCipherMac(new DesEdeEngine());

    DesEdeParameters keyParameters = new DesEdeParameters(macKey);
    DesEdeEngine engine = new DesEdeEngine();
    engine.Init(true, keyParameters);

    macCipher.Init(keyParameters);
    macCipher.BlockUpdate(macData, 0, macData.Length);
    macCipher.DoFinal(macBytes, 0);
    .......
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dlitz.net/pipermail/pycrypto/attachments/20130226/02ae43c3/attachment.html>


More information about the pycrypto mailing list