Author

Topic: Help to understand part of algorithm in excel (Read 918 times)

jr. member
Activity: 45
Merit: 4
August 31, 2015, 01:21:17 PM
#3
Thank you very much for your help
staff
Activity: 3458
Merit: 6793
Just writing some code
I'm keen on understanding how the algorithm works. I've understood bits and bobs via https://www.youtube.com/watch?v=UZBZPOEVyJA and the excel file associated with it.

I am struggling to understand what these values mean in excel however:

MID(HEX2BIN(IF(ISERROR(MID(D13,LEN(D13),1)),0, MID(D13,LEN(D13),1)),4),4,1)

I get what hex2bin means (hex to binary) but what does the rest actually mean? Am I right in assuming "mid" would mean middle range or something similar.

Please help if you have a better understanding of the formula and bitcoin algo
MID is actually taking a substring with these parameters
Code:
MID( text, start_position, number_of_characters )


So lets start with
Code:
 IF(ISERROR(MID(D13,LEN(D13),1)),0, MID(D13,LEN(D13),1))
This chunk of code means
Code:
If the last character of D13(substring of 1 character starting at the character at the length of D13) is an error, then output is 0. Otherwise the output is the last character
The output of the if statement goes into HEX2BIN which takes paramters
Code:
HEX2BIN(number, [places])
where number is the number and places is the number of characters to use. In this case, 4.

The remaining code comes out to mean
Code:
The substring of the output of the 4 character hex to bin conversion of the last character of D13 or 0 starting at the 4th character with a size of 1 character.

Basically it is taking the last character of the binary output of either the last character of D13 or 0.
jr. member
Activity: 45
Merit: 4
I'm keen on understanding how the algorithm works. I've understood bits and bobs via https://www.youtube.com/watch?v=UZBZPOEVyJA and the excel file associated with it.

I am struggling to understand what these values mean in excel however:

MID(HEX2BIN(IF(ISERROR(MID(D13,LEN(D13),1)),0, MID(D13,LEN(D13),1)),4),4,1)

I get what hex2bin means (hex to binary) but what does the rest actually mean? Am I right in assuming "mid" would mean middle range or something similar.

Please help if you have a better understanding of the formula and bitcoin algo
Jump to: