Bitcoin Forum

Other => Off-topic => Topic started by: yokosan on April 22, 2013, 10:55:56 AM



Title: Chicken and egg hash
Post by: yokosan on April 22, 2013, 10:55:56 AM
Bit of a strange question but it may be semi-relevant to this forum.

Let's say I want to create a program. This program will work out the SHA-256 hash of itself and use the hash to check it's own validity.

In order to do this you will need to know the hash of the code before the code has been written, so how would you do it?

(almost) impossible?


Title: Re: Chicken and egg hash
Post by: Phinnaeus Gage on April 22, 2013, 11:08:49 AM
Bit of a strange question but it may be semi-relevant to this forum.

Let's say I want to create a program. This program will work out the SHA-256 hash of itself and use the hash to check it's own validity.

In order to do this you will need to know the hash of the code before the code has been written, so how would you do it?

(almost) impossible?

Thanks alot, bud! Now BFL will be pre-selling another contraption.


Title: Re: Chicken and egg hash
Post by: organofcorti on April 22, 2013, 11:09:50 AM
Damnit! I thought this would be a recipe thread.


Title: Re: Chicken and egg hash
Post by: Phinnaeus Gage on April 22, 2013, 11:19:35 AM
Damnit! I thought this would be a recipe thread.

IBFmatthew:

Stewed Dog (wedding style)

 Recipe By     : Joe Sweeney
 Serving Size  : 30   Preparation Time :3:00
 Categories    : Ethnic                           Lamb
                 Philippines
 
   Amount  Measure       Ingredient -- Preparation Method
 --------  ------------  --------------------------------
    3      kg            dog meat -- * see note
    1 1/2  cups          vinegar
   60                    peppercorns -- crushed
    6      tablespoons   salt
   12      cloves        garlic -- crushed
      1/2  cup           cooking oil
    6      cups          onion -- sliced
    3      cups          tomato sauce
   10      cups          boiling water
    6      cups          red pepper -- cut into strips
    6      pieces        bay leaf
    1      teaspoon      tabasco sauce
    1 1/2  cups          liver spread -- ** see note
    1      whole         fresh pineapple -- cut 1/2 inch thick
 
 1. First, kill a medium sized dog, then burn off the fur over a hot fire.
 2. Carefully remove the skin while still warm and set aside for later (may be
used in other recpies)
 3. Cut meat into 1″ cubes. Marinade meat in mixture of vinegar, peppercorn,
salt and garlic for 2 hours.
 4. Fry meat in oil using a large wok over an open fire, then add onions and
chopped pineapple and suate until tender.
 5. Pour in tomato sauce and boiling water, add green peper, bay leaf and
tobasco.
 6. Cover and simmer over warm coals until meat is tender. Blend in liver spread
and cook for additional 5-7 minutes.
 
 * you can substiture lamb for dog. The taste is similar, but not as pungent.
 ** smooth liver pate will do as well.


Title: Re: Chicken and egg hash
Post by: benjamindees on April 24, 2013, 09:29:41 AM
The way this is usually done is to place the hash at the end of the binary after it's been compiled, with the code referencing this point.