python/recreating checksum value

JC0133

Senior member
Nov 2, 2010
201
1
76
So I am submitting a programming script. It is for my software security class. I am hacking a public and private key.

I realized to get this password, I need to recreate the checksum value that was used to sign the hashfile with the private key.

So for example I

if I run " cksum example.py" in my terminal I will get the checksum value. Let say that value is 100500. Lets say the value that I need(that I know is already validated is 300500).

So I need to run a python script that will open a certain file in a working directory. That is easy. The problem is that file does not give me the correct checksum

So I figured I could do this 2 ways. I am just looking for some guidance on the code and if either way makes sense.

1) I can keep editing that file until I get the right checksum value, with code that will not mess up my script. Like a # for comments or space or enter. But here I would need to some how check the checksum value. Not sure how to do that in the script??

2) I can do something like this

cksum openFile.py >> whatever.txt; echo 300500 60 example.py

Now I did that in my terminal and it works but how do I put that in a script where when
the server runs cksum on the openFile.py it redirects the real output to whatever.txt and echo out
the proper checksum info and then

it reads the proper file from the working directory??