diff --git a/SDK/miner_raw/mine.html b/SDK/miner_raw/mine.html index 1141d2c..c84246a 100644 --- a/SDK/miner_raw/mine.html +++ b/SDK/miner_raw/mine.html @@ -1,6 +1,10 @@ + + + + @@ -24,7 +28,6 @@ /* start mining, use a local server */ server = "ws://localhost:8181"; - startMining("moneroocean.stream", "422QQNhnhX8hmMEkF3TWePWSvKm6DiV7sS3Za2dXrynsJ1w8U6AzwjEdnewdhmP3CDaqvaS6BjEjGMK9mnumtufvLmz5HJi"); diff --git a/SDK/miner_raw/miner/miner.js b/SDK/miner_raw/miner/miner.js index 5dfd108..ade220a 100644 --- a/SDK/miner_raw/miner/miner.js +++ b/SDK/miner_raw/miner/miner.js @@ -241,6 +241,7 @@ function informWorker(wrk) { } function on_servermsg(e) { + console.log(e.data); var obj = JSON.parse(e.data); receiveStack.push(obj); diff --git a/hash_cn/libhash/cryptonight.c b/hash_cn/libhash/cryptonight.c index 84cd9da..319994d 100644 --- a/hash_cn/libhash/cryptonight.c +++ b/hash_cn/libhash/cryptonight.c @@ -135,11 +135,6 @@ // -------------------------------------- VARIANT 4 --------------------------------------------- -struct V4_Instruction code[NUM_INSTRUCTIONS_MAX + 1]; -int lastHeight = -1; -v4_reg r[9]; - - #define V4_REG_LOAD(dst, src) \ do \ { \ @@ -148,16 +143,14 @@ v4_reg r[9]; } while (0) #define VARIANT4_RANDOM_MATH_INIT() \ + struct V4_Instruction code[NUM_INSTRUCTIONS_MAX + 1]; \ + v4_reg r[9]; \ do \ if (variant >= 4) \ { \ for (int i = 0; i < 4; ++i) \ V4_REG_LOAD(r + i, (uint8_t *)(state.hs.w + 12) + sizeof(v4_reg) * i); \ - if (lastHeight != height) \ - { \ - v4_random_math_init(code, height); \ - lastHeight = height; \ - } \ + v4_random_math_init(code, height); \ } \ while (0) @@ -500,10 +493,10 @@ void SubAndShiftAndMixAddRoundInPlace(uint32_t *temp, uint32_t *AesEncKey) temp[3] = TestTable2[saved[3]] ^ TestTable3[saved[4]] ^ TestTable4[saved[5]] ^ TestTable1[state[12]] ^ AesEncKey[3]; } -uint8_t text[INIT_SIZE_BYTE]; void cryptonight_hash_ctx(void *output, const void *input, size_t len, int algo, int variant, int height) { + uint8_t text[INIT_SIZE_BYTE]; uint8_t *long_state; oaes_ctx *aes_ctx; diff --git a/hash_cn/webassembly/simple_profile.html b/hash_cn/webassembly/simple_profile.html index afb37f7..2eddef5 100644 --- a/hash_cn/webassembly/simple_profile.html +++ b/hash_cn/webassembly/simple_profile.html @@ -1,10 +1,12 @@ + + + + + - -

- @@ -30,7 +32,6 @@ function checkvariants() { blob = "11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111113"; alert(cn(blob,1,1,0)); // c2e3bd88bffd1bd7855af2dae2a52fef6efd36f00db514a6594718c5b67fab21 - blob = "6465206f6d6e69627573206475626974616e64756d"; alert(cn(blob,0,0,0)); // 2f8e3df40bd11f9ac90c743ca8e32bb391da4fb98612aa3b6cdc639ee00b31f5 diff --git a/server/Server/AlgorithmHelper.cs b/server/Server/AlgorithmHelper.cs index 4a1dfbe..c8b6d58 100644 --- a/server/Server/AlgorithmHelper.cs +++ b/server/Server/AlgorithmHelper.cs @@ -49,6 +49,11 @@ namespace Server { "cn/half", new Tuple("cn-half", 2) } }; + public static bool ValidAlgorithm(string algo) + { + return lookup.ContainsKey(algo); + } + public static bool NormalizeAlgorithmAndVariant(JsonData job) { int possibleHeight = 0; diff --git a/server/Server/PoolList.cs b/server/Server/PoolList.cs index 25f5159..110e37d 100644 --- a/server/Server/PoolList.cs +++ b/server/Server/PoolList.cs @@ -66,7 +66,6 @@ namespace Server foreach (string pool in data.Keys) { - JsonData jinfo = data[pool] as JsonData; PoolInfo pi = new PoolInfo(); @@ -76,10 +75,14 @@ namespace Server pi.Url = jinfo["url"].GetString(); pi.EmptyPassword = jinfo["emptypassword"].GetString(); + pi.DefaultAlgorithm = jinfo["algorithm"].GetString(); pi.Port = int.Parse(jinfo["port"].GetString()); - pl.pools.Add(pool, pi); + if (!AlgorithmHelper.ValidAlgorithm(pi.DefaultAlgorithm)) + throw new Exception("Invalid algorithm found in pools.json: " + pi.DefaultAlgorithm ); + + pl.pools.Add(pool, pi); } diff --git a/server/Server/Program.cs b/server/Server/Program.cs index 42f83cb..5518033 100644 --- a/server/Server/Program.cs +++ b/server/Server/Program.cs @@ -37,7 +37,6 @@ namespace Server public class Client { - public PoolConnection PoolConnection; public IWebSocketConnection WebSocket; public string Pool = string.Empty; @@ -536,7 +535,7 @@ namespace Server { string testStr = new string('1', 151) + '3'; - IntPtr ptr = hash_cn(testStr, 1, 0,0); + IntPtr ptr = hash_cn(testStr,1, 0,0); string str = Marshal.PtrToStringAnsi(ptr); hash_free(ptr); diff --git a/server/pools.json b/server/pools.json index c97f292..f55769d 100644 --- a/server/pools.json +++ b/server/pools.json @@ -31,7 +31,7 @@ "aeonpool.xyz" : { "url" : "mine.aeonpool.xyz", "port" : 3333, "emptypassword" : "", "algorithm" : "cn-lite/1" }, "aeonpool.dreamitsystems.com" : { "url" : "aeonpool.dreamitsystems.com", "port" : 13333, "emptypassword" : "x", "algorithm" : "cn-lite/1" }, "aeonminingpool.com" : { "url" : "pool.aeonminingpool.com", "port" : 3333, "emptypassword" : "x", "algorithm" : "cn-lite/1" }, - "aeonhash.com" : { "url" : "pool.aeonhash.com", "port" : 3333, "emptypassword" : "", "algorithm" : "cn-lite" }, + "aeonhash.com" : { "url" : "pool.aeonhash.com", "port" : 3333, "emptypassword" : "", "algorithm" : "cn-lite/1" }, "durinsmine.com" : { "url" : "mine.durinsmine.com", "port" : 3333, "emptypassword" : "x", "algorithm" : "cn-lite/1" }, "aeon.uax.io" : { "url" : "mine.uax.io", "port" : 4446, "emptypassword" : "", "algorithm" : "cn-lite/1" }, "aeon-pool.sytes.net" : { "url" : "aeon-pool.sytes.net", "port" : 3333, "emptypassword" : "", "algorithm" : "cn-lite/1" }, @@ -40,9 +40,9 @@ "pooltupi.com" : { "url" : "pooltupi.com", "port" : 8080, "emptypassword" : "x", "algorithm" : "cn-lite/1" }, "aeon.semipool.com" : { "url" : "pool.aeon.semipool.com", "port" : 3333, "emptypassword" : "x", "algorithm" : "cn-lite/1" }, - "turtlepool.space" : { "url" : "eu.turtlepool.space", "port" : 3333, "emptypassword" : "", "algorithm" : "cn-pico" }, + "turtlepool.space" : { "url" : "eu.turtlepool.space", "port" : 3333, "emptypassword" : "", "algorithm" : "cn-pico/trtl" }, - "masari.miner.rocks" : { "url" : "masari.miner.rocks", "port" : 5005, "emptypassword" : "", "algorithm" : "cn-half/half" }, + "masari.miner.rocks" : { "url" : "masari.miner.rocks", "port" : 5005, "emptypassword" : "", "algorithm" : "cn/half" }, "etn.spacepools.org" : { "url" : "pool.etn.spacepools.org", "port" : 80, "emptypassword" : "", "algorithm" : "cn/0"}, "etn.nanopool.org" : { "url" : "etn-eu1.nanopool.org", "port" : 13333, "emptypassword" : "x", "algorithm" : "cn/0" },