1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
<tt>
Legrandin,<div><br></div><div>I think you are on to something here. Removing the initialization vector from both pycrypto and as3crypto produces the same b64encoded output. I&#39;ve been playing around with different IV&#39;s but I can only get the output to match without the presence of an IV.</div><br>
<div><br></div><div>This does lead me to believe that the IV is the source of my problem but if anyone can think of a reason why this might not be, it would be helpful to know as I don&#39;t want to be on the wrong track.</div><br>
<div><br></div><div>I haven&#39;t done much coding at the byte level (I&#39;m mainly a web developer, and not seasoned by any means), I&#39;ll keep trucking from here I suppose.</div><div><br></div><div>Regards,</div><div><br>
Joshua</div><div><br><div class="gmail_quote">On Wed, Jan 12, 2011 at 1:15 PM, Legrandin <span dir="ltr">&lt;<a href="mailto:gooksankoo@hoiptorrow.mailexpire.com">gooksankoo@hoiptorrow.mailexpire.com</a>&gt;</span> wrote:<br><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">&gt; var t_byAry:ByteArray = Hex.toArray( Hex.fromString( t_toEnc ) );<br><br>
&gt; var t_key:ByteArray = Hex.toArray( Hex.fromString( &#39;Thisisthekey&#39; ) );<br><br>
&gt; var t_cbc:CBCMode = new CBCMode( new BlowFishKey( t_key ), new NullPad );<br><br>
</div><div class="im">&gt; t_cbc.IV = Hex.toArray( &#39;30313233&#39; );<br><br>
&gt; t_cbc.encrypt( t_byAry );<br><br>
&gt; t_enc = Base64.encodeByteArray( t_byAry );<br><br>
<br><br>
</div><div class="im">&gt; &gt;&gt;&gt; from Crypto.Cipher import Blowfish<br><br>
&gt; &gt;&gt;&gt; B = Blowfish.new( &#39;Thisisthekey&#39;, Blowfish.MODE_CBC, &#39;30313233&#39; )<br><br>
<br><br>
</div>Could it be that in you AS code your IV is 4 bytes (0x30,0x31,0x32,0x33)<br><br>
which t_cbc.encrypt() silently pads, whereas in the python code it is 8<br><br>
different bytes (0x33 for &#39;3&#39;, 0x30 for &#39;0&#39;, etc)?<br><br>
<font color="#888888"><br><br>
Legrandin<br><br>
</font><div><div></div><div class="h5"><br><br>
_______________________________________________<br><br>
pycrypto mailing list<br><br>
<a href="mailto:pycrypto@lists.dlitz.net">pycrypto@lists.dlitz.net</a><br><br>
<a href="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto" target="_blank">http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto</a><br><br>
</div></div></blockquote></div><br></div><br>
</tt>
|