pull down to refresh

Do you have this nodejs program shared somewhere? I’d like to look at it, for academic purposes

var crypto = require( 'crypto' )
var sha256 = s => {
    if ( typeof s == "string" ) s = new TextEncoder().encode( s );
    return crypto.subtle.digest( 'SHA-256', s ).then( hashBuffer => {
        var hashArray = Array.from( new Uint8Array( hashBuffer ) );
        var hashHex = hashArray
            .map( bytes => bytes.toString( 16 ).padStart( 2, '0' ) )
            .join( '' );
        return hashHex;
    });
}

var i = 0;
var hasher = async () => {
    var hash = await sha256( `test ${i}` );
    i = i + 1;
    if ( String( i ).endsWith( "00000" ) ) console.log( i );
    if ( i < 1000000 ) hasher();
}
hasher();
reply
reply

Conceivably, you could run multiple instances of this program at the same time to get more output out of your laptop, right? Surely this isn't making the most out of a multi-core processor?

I realize the difference between an ASIC and this is still astronomical, but for the sake of argument.

reply

GPU-optimized algo should be much faster than the CPU one, before ASICs Bitcoin was briefly mined on GPUs

reply

Most definitely. I am mostly just asking to see if every hash of performance was squeezed out of the laptop for the sake of comparison

reply

probably not, I don't know anything about performance optimization

reply

I don't know how to do that though, or how to tell my gpu to run a program instead of my cpu

reply