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

Michael Niedermayer michaelni
Wed Jul 15 17:20:15 CEST 2009


On Wed, Jul 15, 2009 at 05:53:24PM +0300, Kostya wrote:
> On Wed, Jul 15, 2009 at 04:02:44PM +0200, Michael Niedermayer wrote:
> > On Wed, Jul 15, 2009 at 12:04:50PM +0300, Kostya wrote:
> > > On Tue, Jul 14, 2009 at 12:34:45PM +0200, Michael Niedermayer wrote:
> > > > On Sun, Jul 12, 2009 at 08:23:29AM +0300, Kostya wrote:
> > > > > On Sat, Jul 11, 2009 at 09:13:40PM +0200, Michael Niedermayer wrote:
> > > [...] 
> > > > > > > +#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?
> > > > 
> > > > (w&(x^y))^y
> > > 
> > > Oh, fixed.
> > [...]
> > 
> > >  int av_sha_init(AVSHA* ctx, int bits)
> > >  {
> > > -    ctx->state[0] = 0x67452301;
> > > -    ctx->state[1] = 0xEFCDAB89;
> > > -    ctx->state[2] = 0x98BADCFE;
> > > -    ctx->state[3] = 0x10325476;
> > > -    ctx->state[4] = 0xC3D2E1F0;
> > > -    ctx->transform = sha1_transform;
> > > -    ctx->count    = 0;
> > [...]
> > > +        ctx->state[0] = 0x67452301;
> > > +        ctx->state[1] = 0xEFCDAB89;
> > > +        ctx->state[2] = 0x98BADCFE;
> > > +        ctx->state[3] = 0x10325476;
> > > +        ctx->state[4] = 0xC3D2E1F0;
> > > +        ctx->transform = sha1_transform;
> > 
> > cosmetics
> 
> Here it is.
[...]
>  int av_sha_init(AVSHA* ctx, int bits)
>  {
> +    if (bits & 0x1F)
> +        return -1;
> +    ctx->digest_len = bits >> 5;
> +    switch (ctx->digest_len) {

switch(bits)
and te if() becomes useless

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090715/e146ccd6/attachment.pgp>



More information about the ffmpeg-devel mailing list