[FFmpeg-devel] [PATCH] SHA-256 support
Michael Niedermayer
michaelni
Tue Jun 9 16:47:09 CEST 2009
On Tue, Jun 09, 2009 at 08:13:40AM +0300, Kostya wrote:
> On Mon, Jun 08, 2009 at 08:07:14PM +0200, Diego Biurrun wrote:
> > On Mon, Jun 08, 2009 at 08:34:37PM +0300, Kostya wrote:
> > > $subj, I'll need that for RTMP
> > > This implementation is made from code by Aaron D. Gifford and
> > > lavu/sha1.c
> > > Conformance vectors are passed on both endian architectures.
> >
> > > #ifndef AVUTIL_SHA1_H
> > > #define AVUTIL_SHA1_H
> >
> > This is not the filename.
>
> Oops, fixed
>
> > > static void transform(uint32_t state[5], const uint8_t buffer[64]){
> >
> > extra good karma for K&R function declarations
> >
> > > for( i = 0; i < len; i++ ){
> > > ctx->buffer[ j++ ] = data[i];
> > > if( 64 == j ){
> >
> > You inconsistently format all those if/for statements throughout the
> > file. I suggest sticking to K&R style, which you already use in most
> > places.
>
> Ahem, I consistently copypaste code from other parts of ffmpeg (in this
> case source is libavutil/sha1.c).
>
> > > #ifdef TEST
> > > #include <stdio.h>
> > > #undef printf
> >
> > Add this file to the list of testprogs in the Makefile.
>
> done
>
> > Diego
> Makefile | 1 +
[...]
> /* Hash a single 512-bit block. This is the core of the algorithm. */
>
> static void transform(uint32_t state[5], const uint8_t buffer[64])
doxy?
> {
> unsigned int i, a, b, c, d, e, f, g, h;
> uint32_t block[80];
> uint32_t T1, T2;
>
> a = state[0];
> b = state[1];
> c = state[2];
> d = state[3];
> e = state[4];
> f = state[5];
> g = state[6];
> h = state[7];
>
> for (i = 0; i < 64; i++) {
> if (i < 16) {
> T1 = block[i] = be2me_32(((const uint32_t*)buffer)[i]);
> } else {
> block[i & 0xF] += block[(i + 9) & 0xF]
> + sigma0_256(block[(i + 1) & 0xF])
> + sigma1_256(block[(i + 14) & 0xF]);
> T1 = block[i & 0xF];
> }
you have lost some optimizations from our sha1 here,
also sha224 should be supported because its almost identical
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- 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/20090609/13285594/attachment.pgp>
More information about the ffmpeg-devel
mailing list