zll855 发表于 2015-6-15 15:07

c++ win下 编译虚拟币挖矿程序 cpuminer

我在win下编译虚拟币挖矿程序cpuminer时各种报错啊 求高手帮助啊
可以在win下成功编译的 小伙伴 联系我 重谢啊{:1_906:}

源码:https://github.com/lucasjones/cpuminer-multi

15808244862 发表于 2015-6-15 15:21

不会编程,帮你顶贴

Ps出来的小赵 发表于 2015-6-15 15:59

现在挖矿形同烧机,所赚难以与所耗持平的……楼主还开个虚拟机挖………………

a81456890 发表于 2015-6-15 21:24

#define SCRYPT_HASH "SHA-2-256"
#define SCRYPT_HASH_BLOCK_SIZE 64
#define SCRYPT_HASH_DIGEST_SIZE 32

typedef uint8_t scrypt_hash_digest;

typedef struct scrypt_hash_state_t {
        uint32_t H;
        uint64_t T;
        uint32_t leftover;
        uint8_t buffer;
} scrypt_hash_state;

static const uint32_t sha256_constants = {
        0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
        0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
        0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
        0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
        0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
        0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
        0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
        0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
};

#define Ch(x,y,z)(z ^ (x & (y ^ z)))
#define Maj(x,y,z) (((x | y) & z) | (x & y))
#define S0(x)      (ROTR32(x,2) ^ ROTR32(x, 13) ^ ROTR32(x, 22))
#define S1(x)      (ROTR32(x,6) ^ ROTR32(x, 11) ^ ROTR32(x, 25))
#define G0(x)      (ROTR32(x,7) ^ ROTR32(x, 18) ^ (x >>3))
#define G1(x)      (ROTR32(x, 17) ^ ROTR32(x, 19) ^ (x >> 10))
#define W0(in,i)   (U8TO32_BE(&in))
#define W1(i)      (G1(w) + w + G0(w) + w)
#define STEP(i) \
        t1 = S0(r) + Maj(r, r, r); \
        t0 = r + S1(r) + Ch(r, r, r) + sha256_constants + w; \
        r = r; \
        r = r; \
        r = r; \
        r = r + t0; \
        r = r; \
        r = r; \
        r = r; \
        r = t0 + t1;

static void
sha256_blocks(scrypt_hash_state *S, const uint8_t *in, size_t blocks) {
        uint32_t r, w, t0, t1;
        size_t i;

        for (i = 0; i < 8; i++) r = S->H;

        while (blocks--) {
                for (i =0; i < 16; i++) { w = W0(in, i); }
                for (i = 16; i < 64; i++) { w = W1(i); }
                for (i =0; i < 64; i++) { STEP(i); }
                for (i =0; i <8; i++) { r += S->H; S->H = r; }
                S->T += SCRYPT_HASH_BLOCK_SIZE * 8;
                in += SCRYPT_HASH_BLOCK_SIZE;
        }
}

static void
scrypt_hash_init(scrypt_hash_state *S) {
        S->H = 0x6a09e667;
        S->H = 0xbb67ae85;
        S->H = 0x3c6ef372;
        S->H = 0xa54ff53a;
        S->H = 0x510e527f;
        S->H = 0x9b05688c;
        S->H = 0x1f83d9ab;
        S->H = 0x5be0cd19;
        S->T = 0;
        S->leftover = 0;
}

static void
scrypt_hash_update(scrypt_hash_state *S, const uint8_t *in, size_t inlen) {
        size_t blocks, want;

        /* handle the previous data */
        if (S->leftover) {
                want = (SCRYPT_HASH_BLOCK_SIZE - S->leftover);
                want = (want < inlen) ? want : inlen;
                memcpy(S->buffer + S->leftover, in, want);
                S->leftover += (uint32_t)want;
                if (S->leftover < SCRYPT_HASH_BLOCK_SIZE)
                        return;
                in += want;
                inlen -= want;
                sha256_blocks(S, S->buffer, 1);
        }

        /* handle the current data */
        blocks = (inlen & ~(SCRYPT_HASH_BLOCK_SIZE - 1));
        S->leftover = (uint32_t)(inlen - blocks);
        if (blocks) {
                sha256_blocks(S, in, blocks / SCRYPT_HASH_BLOCK_SIZE);
                in += blocks;
        }

        /* handle leftover data */
        if (S->leftover)
                memcpy(S->buffer, in, S->leftover);
}

static void
scrypt_hash_finish(scrypt_hash_state *S, uint8_t *hash) {
        uint64_t t = S->T + (S->leftover * 8);

        S->buffer = 0x80;
        if (S->leftover <= 55) {
                memset(S->buffer + S->leftover + 1, 0, 55 - S->leftover);
        } else {
                memset(S->buffer + S->leftover + 1, 0, 63 - S->leftover);
                sha256_blocks(S, S->buffer, 1);
                memset(S->buffer, 0, 56);
        }

        U64TO8_BE(S->buffer + 56, t);
        sha256_blocks(S, S->buffer, 1);

        U32TO8_BE(&hash[ 0], S->H);
        U32TO8_BE(&hash[ 4], S->H);
        U32TO8_BE(&hash[ 8], S->H);
        U32TO8_BE(&hash, S->H);
        U32TO8_BE(&hash, S->H);
        U32TO8_BE(&hash, S->H);
        U32TO8_BE(&hash, S->H);
        U32TO8_BE(&hash, S->H);
}

static const uint8_t scrypt_test_hash_expected = {
        0xee,0x36,0xae,0xa6,0x65,0xf0,0x28,0x7d,0xc9,0xde,0xd8,0xad,0x48,0x33,0x7d,0xbf,
        0xcb,0xc0,0x48,0xfa,0x5f,0x92,0xfd,0x0a,0x95,0x6f,0x34,0x8e,0x8c,0x1e,0x73,0xad,
};

this pre means 'us sucass'

笨.蛋 发表于 2015-6-15 21:34

现在都用矿机啦...所以A卡销量很好..

zll855 发表于 2015-6-16 14:14

a81456890 发表于 2015-6-15 21:24
#define SCRYPT_HASH "SHA-2-256"
#define SCRYPT_HASH_BLOCK_SIZE 64
#define S ...

头部定义 不行啊

zll855 发表于 2015-6-16 14:15

笨.蛋 发表于 2015-6-15 21:34
现在都用矿机啦...所以A卡销量很好..

N卡很早之前也可以挖矿了

a81456890 发表于 2015-6-19 02:01

zll855 发表于 2015-6-16 14:15
N卡很早之前也可以挖矿了

CUDA 现在卡挖不动,直接是矿机上
页: [1]
查看完整版本: c++ win下 编译虚拟币挖矿程序 cpuminer