CRC-module

Darrell news at dorb.com
Wed Nov 24 10:47:10 EST 1999


>From Fredrik's post:
    sha (160-bit digest)

So more bits are better and 160 bits is best.
UNTESTED:
shaHash=sha.sha(open(yourFile).read()).digest()

The output is a number. But if you look at any 8bits of the 160 possible
bits.
Some may be printable characters.

--
--Darrell
"Thomas Weholt" <thomas at bibsyst.no> wrote in message
news:383C1089.1D0F7C18 at bibsyst.no...
> Hi,
>
> Ok, so I`ve looked into zlib.crc32 and zlib.adler32. They seem easy
> enough to use, but I thought crc-codes had characters and numbers in
> them, not just a plain integer like the methods above return. ( As you
> can see, I`m a complete ass on this subject, but don`t have time to do
> the proper research myself, and was hoping for a "quick fix" ... )
>
> A friend of mine mentioned that I should try SHA-1 instead, for more
> accuracy. Can anybody give me an example on how to compute crc-codes,
> using zlib or preferrably some more accurate method, for single files ??
>
> If this is all it takes :
>
> crc = module_name.crc_method(file)
>
> and comparison is done like :
>
> if (crc1 == crc2): print "Equal."
> else : print "Different."
>
> then all I need is the name of the most effective/accurate module to
> use.
>
> If, for some strange reason, I should use one module instead of another,
> that info would be interesting too.
>
> I`ll stop bother you now and let you get back to work. ;->
>
> Thomas Weholt
>
> --
> http://www.python.org/mailman/listinfo/python-list






More information about the Python-list mailing list