[FFmpeg-devel] [PATCH] Add SHA-2

Kostya kostya.shishkov
Sun Jul 12 07:23:29 CEST 2009


On Sat, Jul 11, 2009 at 09:13:40PM +0200, Michael Niedermayer wrote:
> On Fri, Jul 10, 2009 at 06:58:17PM +0300, Kostya wrote:
> > On Fri, Jul 10, 2009 at 10:48:32AM +0200, Michael Niedermayer wrote:
> > > On Fri, Jul 10, 2009 at 08:03:52AM +0300, Kostya wrote:
> > [...]
> > > > 
> > > > Here's simple renaming and preparing for future SHA-2.
> > > >  
> > > > > [...]
> > > > > -- 
> > > > > Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> > > 
> > > >  Makefile |    4 -
> > > >  sha.c    |   58 ++++++++++++-----
> > > >  sha.h    |   18 ++---
> > > >  sha1.c   |  212 ---------------------------------------------------------------
> > > >  sha1.h   |    3 
> > > >  5 files changed, 56 insertions(+), 239 deletions(-)
> > > > 183128e2b269fa450d5637db3674e7b9a1046527  sha-rename.patch
> > > 
> > > ok
> > 
> > Applied, and here's SHA-2 enhancement.
> [...]
> 
> > +#define ROR32(b,x)  (((x) >> (b)) | ((x) << (32 - (b))))
> 
> duplicate of rol()
 
dropped
 
> > +#define Ch(x,y,z)   (((x) & (y)) ^ ((~(x)) & (z)))
> > +#define Maj(x,y,z)  (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
> 
> you duplicate optimized code with optimizations removed

huh?
SHA-1 and SHA-2 differ in computation method.
While in SHA-1 you have 4 different function and 4 words which can be
unrolled into separate operations (R0-R4), SHA-2 consistently uses the
same set of the functions and 64 constants so its code is the same for
all rounds except for T1 input value.

> [...]
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sha2.patch
Type: text/x-diff
Size: 8139 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090712/8a80dc4d/attachment.patch>



More information about the ffmpeg-devel mailing list