[FFmpeg-devel] [PATCH] SHA-256 support

Kostya kostya.shishkov
Thu Jun 11 11:12:25 CEST 2009


On Thu, Jun 11, 2009 at 08:10:03AM +0300, Kostya wrote:
> On Wed, Jun 10, 2009 at 07:41:59PM +0200, Michael Niedermayer wrote:
> > On Wed, Jun 10, 2009 at 06:11:49PM +0300, Kostya wrote:
[...]
> > 
> > these functions look very similar to sha1
> > cant they be shared?
> 
> In essence, there are such differences from SHA-1:
> * different digest size
> * different initialization data
> * different transform
> * different digest size
> 
> Maybe I should rename existing files into sha.[ch] and extend it
> instead:
> 
> /**
>  * Initializes SHA hashing.
>  *
>  * @param context pointer to function context (allocate av_sha1_size
>  * bytes of memory and pass here)
>  * @param bits    number of bits in digest (SHA-1 - 160 bits, SHA-2 224
>  * or 256 bits; 384 or 512 bits may be supported in the future)
>  * @return 0 if initialization succeeded, -1 otherwise
>  */
> 
> int av_sha_init(AVSHA* context, int bits) 

And here's proof of concept (contains cosmetics, I have not reformatted
sha1.c yet).
  
> > [...]
> > -- 
> > Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB



More information about the ffmpeg-devel mailing list