Author

Topic: JAVA LTC miner target comparing question (Read 597 times)

full member
Activity: 546
Merit: 100
January 09, 2014, 01:20:48 PM
#2
Does any one know this?
full member
Activity: 546
Merit: 100
December 22, 2013, 06:00:06 PM
#1
Hi!

I've been looking at the code for a LTC miner written in java(https://github.com/pooler/JMiner). And have a question

Is the way he compares the target and hash correct? I thought you had to compare them as numbers not individual bits

Code:
 
 for (int i = hash.length - 1; i >= 0; i--) {
                        if ((hash[i] & 0xff) > (target[i] & 0xff))
                                return false;
                        if ((hash[i] & 0xff) < (target[i] & 0xff))
                                return true;
                }
                return true;

The whole code https://github.com/pooler/JMiner/blob/master/src/org/litecoinpool/miner/Work.java
Jump to: