<div dir="ltr"><div style>I'm trying to translate some Java code that uses BouncyCastle to Python using PyCrypto.</div><div style>Does any one know what the equivalent code in python would be for the snippet below?</div>
<div style><br></div><div style><br></div><div>public String getMAC(byte[] macData, byte[] macKey)</div><div> byte[] macBytes = new byte[4];</div><div> CbcBlockCipherMac macCipher = new CbcBlockCipherMac(new DesEdeEngine());</div>
<div> </div><div> DesEdeParameters keyParameters = new DesEdeParameters(macKey);</div><div> DesEdeEngine engine = new DesEdeEngine();</div><div> engine.Init(true, keyParameters);</div><div> </div><div>
macCipher.Init(keyParameters);</div><div> macCipher.BlockUpdate(macData, 0, macData.Length);</div><div> macCipher.DoFinal(macBytes, 0);</div><div> .......</div></div>