#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    1
    Rep Power
    0

    *newbie* SHA1 hash computation


    I'm completely new to Python and can't wrap my head around this... I'm currently taking a class on this in post-grad school.

    Okay, so here's what I need to do.

    "Write a Python program that computes SHA1 hashes of a file, but truncates the digest to 8 bits (i.e., throw out all the digest, but the last 8 bits). Use your program to compute the 8-bit SHA1 hash of FILENAME.txt..."

    I'm totally lost and would appreciate any guidance...

    Thanks in advance.
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,996
    Rep Power
    481
    Mask the hash you compute with 255.

    MYHASH & 0xff
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo