Bitcoin Forum
May 03, 2024, 06:01:53 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: SHA Algorithm doubt  (Read 224 times)
so98nn (OP)
Hero Member
*****
Offline Offline

Activity: 2086
Merit: 603


View Profile
May 22, 2020, 04:09:40 PM
Merited by LoyceV (6), joniboini (4), XenoFever (2), JayJuanGee (1), ABCbits (1)
 #1

This is quoted from one of the site which explains SHA algorithm steps.

Quote
The next step is to run a set of functions over the words in a specific order operating off the five variables that were set in step 1. The functions combine AND, OR & NOT operators combined with left shifts.

Hi, I am stuck at one of the step where it says the quoted process.

Step 1 is nothing but creation of five variables, lets say H0 to H4,

For example,

Code:
H0 - 01100111010001010010001100000001
H1 - 11101111110011011010101110001001
H2 - 10011000101110101101110011111110
H3 - 00010000001100100101010001110110
H4 - 11000011110100101110000111110000

Now the above quoted step states that you have to use functions such as AND, OR & NOT to specify the new order in the above code.

I don't understand what they are trying to do here.

How to use those function here and what order to be achieved ?

1714716113
Hero Member
*
Offline Offline

Posts: 1714716113

View Profile Personal Message (Offline)

Ignore
1714716113
Reply with quote  #2

1714716113
Report to moderator
Every time a block is mined, a certain amount of BTC (called the subsidy) is created out of thin air and given to the miner. The subsidy halves every four years and will reach 0 in about 130 years.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714716113
Hero Member
*
Offline Offline

Posts: 1714716113

View Profile Personal Message (Offline)

Ignore
1714716113
Reply with quote  #2

1714716113
Report to moderator
Peanutswar
Legendary
*
Offline Offline

Activity: 1540
Merit: 1034


Top Crypto Casino


View Profile WWW
May 22, 2020, 04:40:04 PM
Last edit: May 22, 2020, 05:00:49 PM by Peanutswar
Merited by LoyceV (6), joniboini (4), Eureka_07 (4), Halab (2), Alucard1 (2), XenoFever (2), JayJuanGee (1), xandry (1), cryptoaddictchie (1)
 #2

Sha is commonly use for an algorithm like in hashing. The AND, OR, and NOT those are the logic gates uses these commonly use for computer language

in AND if there is a 0 the value becomes 0. In boolean expression if there is a false it is already false
Example
001
111

Answer
001

Example
H0 - 01100111010001010010001100000001
H1 - 11101111110011011010101110001001
Answer
01100111010001010010001100000001

In OR if there is a true statement it is already true. If there is 1 it becomes 1
Example
011
111
Answer
111

Example
H2 - 10011000101110101101110011111110
H3 - 00010000001100100101010001110110
Answer
10011000101110101101110011111110

In NOT you are going to reverse the particular value. If this is true the value becomes false.
Example
0

Answer
1

Example
H4 - 11000011110100101110000111110000
Answer
 00111100001011010001111000001111

I hope this will help you to enlighten.

Before I create a simple hashing using SHA-256



Code:
 Random r = new Random();
        char[] codes = "abcdefghijklmnopqrstuvwzyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToArray();
        string output;
        void generateKey(int gkey)
        {
            output = null;
            for (int x = 0; x < codes.Length; x++)
            {
              output += codes[r.Next(0, codes.Length)];
            }

            t1bx.Text = output;
        }

        private void B_generate_Click(object sender, RoutedEventArgs e)
        {
            generateKey(10);
        }

        static string ComputeSha256Hash(string rawData)
        {
            // Create a SHA256  
            using (SHA256 sha256Hash = SHA256.Create())
            {
                // ComputeHash - returns byte array  
                byte[] bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(rawData));

                // Convert byte array to a string  
                StringBuilder builder = new StringBuilder();
                for (int i = 0; i < bytes.Length; i++)
                {
                    builder.Append(bytes[i].ToString("x2"));
                }
                return builder.ToString();
            }
        }


        private void B_hash_Click(object sender, RoutedEventArgs e)
        {
            txtbx_hash.Text = ComputeSha256Hash(output);
        }

    


I hope this will help you how to make a sha.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!