[FFmpeg-devel] [RFC][PATCH 1/3] lavu: Add av_crc2() and av_crc2_init()
Michael Niedermayer
michaelni at gmx.at
Mon Jan 28 15:38:07 CET 2013
On Mon, Jan 28, 2013 at 04:31:53AM -0300, James Almer wrote:
> Functionally the same as av_crc() and av_crc_init(), but
> supporting CRCs of up to 64 bits.
>
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> libavutil/crc.c | 75 ++++++++++++------------------------------
> libavutil/crc.h | 7 ++++
> libavutil/crc_template.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 112 insertions(+), 55 deletions(-)
> create mode 100644 libavutil/crc_template.c
thats a huge mess for calculating a crc once for a few bytes of a
tta password.
something like:
for all bytes
c ^= (uint64_t)*byte++ << 56;
for(i=0; i<8; i++)
c = (c << 1) ^ (poly & (((int64_t) c) >> 63));
in tta will do the samem, saving all the hundreads of lines of code
added to crc.*
besides the code added is buggy
[...]
> + ctx[256] = 1;
> +#if !CONFIG_SMALL
> + if (ctx_size >= sizeof(AVCRCX) * 1024)
> + for (i = 0; i < 256; i++)
> + for (j = 0; j < 3; j++)
> + ctx[256 *(j + 1) + i] =
> + (ctx[256 * j + i] >> 8) ^ ctx[ctx[256 * j + i] & 0xFF];
this is wrong, 64bits are not made of 4 bytes
theres more code thats wrong in the same way
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130128/8c26a10d/attachment.asc>
More information about the ffmpeg-devel
mailing list