<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7525714682895862491</id><updated>2011-04-21T19:54:14.721-07:00</updated><category term='ps3 selb vsel md5 sse2 assembly cracking passwords'/><title type='text'>G924789</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://g924789.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7525714682895862491/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://g924789.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>G924789</name><uri>http://www.blogger.com/profile/16511920337086017984</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_-Q4rqoW4EdI/Sh87Bi3mnGI/AAAAAAAAAAM/BneXyA0OvWI/S220/SlieveLeague.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7525714682895862491.post-1251540336113840082</id><published>2009-05-28T18:42:00.000-07:00</published><updated>2009-05-29T11:20:52.602-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ps3 selb vsel md5 sse2 assembly cracking passwords'/><title type='text'>Magic of SELB / VSEL</title><content type='html'>Last year after reading the &lt;a href="http://www.security-assessment.com/files/presentations/crackstation-njb-bheu08-v2.pdf"&gt;presentation by Nick Breeze&lt;/a&gt; on using the PS3 as a password cracker, I decided to invest in one and investigate myself if it was suitable for password recovery.&lt;br /&gt;&lt;br /&gt;Although I'd planned to write up a little article on the potential of the Cell B.E inside the PS3, never really got the time to develop anything and the following is simply the macros for MD5 which were used.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// selb replaces ((z) ^ ((x) &amp; ((y) ^ (z)))) &lt;br /&gt;#define FF(a,b,c,d,x,t,s)                                           \ &lt;br /&gt;        data[x] = spu_insert(((unsigned int*)buf1)[x],data[x],0);    &lt;br /&gt;        data[x] = spu_insert(((unsigned int*)buf2)[x],data[x],1);    &lt;br /&gt;        data[x] = spu_insert(((unsigned int*)buf3)[x],data[x],2);    &lt;br /&gt;        data[x] = spu_insert(((unsigned int*)buf4)[x],data[x],3);    &lt;br /&gt;        a = spu_add(a, spu_splats((unsigned int)t));                 &lt;br /&gt;        a = spu_add(a, data[x]);                                     &lt;br /&gt;        a = spu_add(a, spu_sel(d,c,b));                              &lt;br /&gt;        a = spu_rl (a, s);                                           &lt;br /&gt;        a = spu_add(a, b); &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// selb replaces ((y) ^ ((z) &amp; ((x) ^ (y)))) &lt;br /&gt;#define GG(a,b,c,d,x,t,s)                               \ &lt;br /&gt;        a = spu_add(a, spu_splats((unsigned int)t));     &lt;br /&gt;        a = spu_add(a, data[x]);                         &lt;br /&gt;        a = spu_add(a, spu_sel(c,b,d));                  &lt;br /&gt;        a = spu_rl (a, s);                               &lt;br /&gt;        a = spu_add(a, b); &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// same 2 xors here for ((x) ^ (y) ^ (z)) &lt;br /&gt;#define HH(a,b,c,d,x,t,s)                               \ &lt;br /&gt;        a = spu_add(a, spu_splats((unsigned int)t));     &lt;br /&gt;        a = spu_add(a, data[x]);                         &lt;br /&gt;        a = spu_add(a, spu_xor(b,spu_xor(c,d)));         &lt;br /&gt;        a = spu_rl (a, s);                               &lt;br /&gt;        a = spu_add(a, b); &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// orc + xor used to replace ((y) ^ ((x) | ~(z))) &lt;br /&gt;#define II(a,b,c,d,x,t,s)                               \ &lt;br /&gt;        a = spu_add(a, spu_splats((unsigned int)t));     &lt;br /&gt;        a = spu_add(a, data[x]);                         &lt;br /&gt;        a = spu_add(a, spu_xor(c,spu_orc(b,d)));         &lt;br /&gt;        a = spu_rl (a, s);                               &lt;br /&gt;        a = spu_add(a, b);  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;As you can see, SELB is very useful instruction.&lt;br /&gt;Looking at MD4 and SHA-1 which use similar instructions, Its possible to optimize G too.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;In the G function of MD4 and SHA-1 we have the following expression: &lt;br /&gt;&lt;br /&gt;        (((x) &amp; (y)) | ((x) &amp; (z)) | ((y) &amp; (z))) &lt;br /&gt;&lt;br /&gt;This was optimized to: &lt;br /&gt;&lt;br /&gt;        (x &amp; y) | (z &amp; (x | y)) &lt;br /&gt;&lt;br /&gt;and using the SPU or PPE vector instructions, we can &lt;br /&gt;do it with 2 VSEL or SELB opcodes.&lt;br /&gt;                 &lt;br /&gt;        t = spu_sel(y,x,spu_sel(y,x,z)); &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Maybe someone will find it useful, who knows.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7525714682895862491-1251540336113840082?l=g924789.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://g924789.blogspot.com/feeds/1251540336113840082/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://g924789.blogspot.com/2009/05/magic-of-selb-vsel.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7525714682895862491/posts/default/1251540336113840082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7525714682895862491/posts/default/1251540336113840082'/><link rel='alternate' type='text/html' href='http://g924789.blogspot.com/2009/05/magic-of-selb-vsel.html' title='Magic of SELB / VSEL'/><author><name>G924789</name><uri>http://www.blogger.com/profile/16511920337086017984</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_-Q4rqoW4EdI/Sh87Bi3mnGI/AAAAAAAAAAM/BneXyA0OvWI/S220/SlieveLeague.jpg'/></author><thr:total>3</thr:total></entry></feed>
