Hash mining | Computer Science homework help

  

Part 1

· Hash Mining. Name the file hash_mining.py.
Write a program that accepts an input string, and outputs a SHA256 hash with a predefined pattern for that input string. You will define your own format for the hashes (see below).
 

Here is a sample execution of a program looking for hashes that start with “0000” using the input “Joe Snuffy”  

· HASH MINER

· by me

·  

· Input Text: Joe Snuffy

· Hash Found: 00000cf0a4c5c566bc1cf869f14974e97b0350063e640c6fb7b4531715d7c2a7

· Nonce: 19334

 Watch the first 5 mins of the following video for a description of process of hash mining: 

Play Video

 

We shall call the process of finding a particular hash “Hash Mining,” and it works as follows (pseudo code):

 

1. Ask user for input string s

2. Set the variable nonce to 1

3. Let C be the result of concatenating s and nonce as a string

4. Let H be the hash corresponding to C

5. While H has NOT the right format Do

6….Add one to nonce

7….Set C to the result of concatenating s and nonce

8….Let H the hash corresponding to C

9. End While

10. Display hash H

11. Display nonce value

 Notes:
– Steps 7 and 8, are the same as 3 and 4.
– To obtain H in step 4 use: H = get_hash(C) . This function is provided below.
– In order to concatenate nonce at the end of s, you need to convert nonce to a string.
– In order to decide the condition in step 5 see below.
 

Hash Format
In the example above, the format of the hash is that it starts with ‘0000’
For this assignment, you will choose your own prefix pattern by using a word with at least 4 characters, and spelled only using the letters a thru f. You can find a list here: http://www.alecjacobson.com/weblog/?p=475
 

Theget_hash Function
In order to get the SHA256 hash of a string, add to your program the code below:

importhashlib

defget_hash(string):

   m = hashlib.sha256()

   m.update(str.encode(string))

   returnm.hexdigest()

Mine A Hash For Your Name
Run the program using your full name as input. Copy the output hash at then end of your program as a comment. (10 out of 50 points)
 

How Do I Know It Actually Worked?
First, make sure the output hash has the format you selected.
Then, copy and paste the code above (the import statement and the get_hash function) in the shell. Last, call the function with your full name and the nonce together. For example, using the input “Angel Rivera” and the nonce 19334 we get:

>>>get_hash(“Joe Snuffy19334“)

00000cf0a4c5c566bc1cf869f14974e97b0350063e640c6fb7b4531715d7c2a7

Part 2

· List Maintainer. Name program list_maintainer.py
Write a program that allows the user to add, delete and organize the items in a list.
Your program will provide the following options:

o Append: adds an items, input by the user, at the end of the list.

o Delete: removes an item indicated by the user from the list.

o Move up: moves an item indicated by the user, to the previous position in the list.

o Move Down: moves an item indicated by the user to the next position in the list.

o Move Top: moves an item indicated by the user to the first spot in the list.

o Move Bottom: moves an item indicated by the user to the last position in the list.

o Swap: swaps two items indicated by the user in the list.

o List all: display the items in the list; one item per line.

o Quit: allows the user to end the program.

Your program shall show appropriate error messages when trying to move, swap, or delete items not found in the list. 

You program shall also properly handle invalid actions, like trying to move up the first item in the list, or trying to move down the last item in the list.

In order to get you started, download the file list_maintainer_base.py which you can find at the bottom of this page.

Here is a sample run. Let’s assume we already added the following items (in this order): cake, cookies, ice cream.

Adding “donuts”

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more