• Giorgio Vazzana's avatar
    md5: consistently use uint32_t instead of unsigned int · c78cf00b
    Giorgio Vazzana authored
    Basically to make code clearer and adherent to the
    standard. RFC 1321, on page 2 states
    
    Let the symbol "+" denote addition of words (i.e., modulo-2^32
    addition). Let X <<< s denote the 32-bit value obtained by circularly
    shifting (rotating) X left by s bit positions.
    
    on page 3, section 3.3 states:
    
    A four-word buffer (A,B,C,D) is used to compute the message digest.
    Here each of A, B, C, D is a 32-bit register.
    
    so the algorithm needs to work with integers that are exactly 32bits
    in length. And indeed in struct AVMD5 the MD buffer is declared as
    "uint32_t ABCD[4];", while in the function that performs the block
    transformation the state variables were "unsigned int"s. On
    architectures where sizeof(unsigned int) != sizeof(uint32_t) this
    could be a problem, although I can't name such an architecture from
    the top of my head.
    On a side note, both the reference implementation in RFC 1321 and the
    gnulib implementation (used by md5sum program on GNU systems) use
    uint32_t in the transform function.
    Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
    c78cf00b
Name
Last commit
Last update
doc Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
mt-work Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitignore Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
Doxyfile Loading commit data...
INSTALL Loading commit data...
LICENSE Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...
RELEASE Loading commit data...
arch.mak Loading commit data...
cmdutils.c Loading commit data...
cmdutils.h Loading commit data...
cmdutils_common_opts.h Loading commit data...
common.mak Loading commit data...
configure Loading commit data...
ffmpeg.c Loading commit data...
ffplay.c Loading commit data...
ffprobe.c Loading commit data...
ffserver.c Loading commit data...
library.mak Loading commit data...
version.sh Loading commit data...