public Game(Variation variation, AlgorithmType algorithmType) : this() { Variation = variation; AlgorithmType = algorithmType; Initialize(); }
public static bool CanRunAlgorithm(out string aError,AlgorithmType aAlgType) { bool _result = true; string _algType = aAlgType.ToString(); aError = ""; if (Set == null) { _result = false; aError = "You must load a DataSet to apply a " + _algType + " algorithm. \r\n"; return _result; } if (aAlgType == AlgorithmType.Clustering && (AttributesToCalculateProximity == null || AttributesToCalculateProximity.Count == 0)) { _result = false; aError += "You must select at least one attribute to apply a " + _algType + " algorithm. \r\n"; } if (aAlgType == AlgorithmType.Clustering && Proximity == null) { _result = false; aError += "You must select a Proximity to apply a " + _algType + " algorithm. \r\n"; } return _result; }
public static void DisplayASTTransform(string patternText, AlgorithmType algorithmType, RegexOptions options) { BasePattern beforePattern = BasePattern.CreatePattern(patternText); BasePattern afterPattern = doTransform(patternText, algorithmType, options); displayASTTransform(patternText, beforePattern, afterPattern); }
/// <summary> /// Creates the decryptor. /// </summary> /// <param name="algType">Type of the alg.</param> /// <param name="key">The key.</param> /// <param name="iv">The iv.</param> /// <param name="entropy">The entropy.</param> /// <returns></returns> public static CryptoManager CreateDecryptor(AlgorithmType algType, byte[] key, byte[] iv, int entropy = 50) { SymmetricAlgorithm algorithm = null; switch (algType) { case AlgorithmType.AES: algorithm = new AesCryptoServiceProvider(); break; case AlgorithmType.DES: algorithm = new DESCryptoServiceProvider(); break; case AlgorithmType.TripleDES: algorithm = new TripleDESCryptoServiceProvider(); break; } var db = new Rfc2898DeriveBytes(key, iv, entropy); if (algorithm != null) { algorithm.Key = db.GetBytes(algorithm.KeySize/8); algorithm.IV = iv; return new CryptoManager(algorithm, algorithm.CreateDecryptor()); } return null; }
public static double GetFormatedSpeed(double speed, AlgorithmType type) { if (_div.ContainsKey(type)) { return speed / _div[type]; } return speed; // should never happen }
public RapidTestAlgorithm(AlgorithmType algorithm) { _algorithm = algorithm; _paramNegative = DataRepository.GetForlabParameterByParamName("RulesBothNegative"); _paramPositive = DataRepository.GetForlabParameterByParamName("RulesBothPositive"); _paramDiscordant = DataRepository.GetForlabParameterByParamName("RulesDiscordant"); InitTestSpec(); }
public Regex2(string patternText, AlgorithmType algorithmType, RegexOptions options) { PatternText = patternText; AlgorithmType = algorithmType; Options = options; Matcher = BaseMatcher.CreateMatcher(AlgorithmType, PatternText, options); }
/// <summary> /// Creates a human or ai player type with the provided attributes /// </summary> /// <param name="pIsAI">True if player will be handles by AI</param> /// <param name="pAlgorithmType">Type of algorithm used by the AI (if AI)</param> /// <param name="pPlieDepth">Plie depth used by the algorithm (if MiniMax or AlphaBeta)</param> /// <param name="pTransTable">Algorithm uses transposition table (if MiniMax or AlphaBeta)</param> /// <param name="pMoveOrdering">Algorithm sorts the moves (if AlphaBeta)</param> public PlayerSettings(bool pIsAI, AlgorithmType pAlgorithmType, int pPlieDepth, bool pTransTable, bool pMoveOrdering, EvaluationType pEt) { IsAI = pIsAI; AlgorithmType = pAlgorithmType; PlieDepth = pPlieDepth; DoTransTable = pTransTable; DoMoveOrdering = pMoveOrdering; EvaluationFunction = pEt; }
public override string GetOptimizedMinerPath(AlgorithmType algorithmType, string devCodename, bool isOptimized) { if (AlgorithmType.Decred == algorithmType) { return MinerPaths.ccminer_decred; } if (AlgorithmType.CryptoNight == algorithmType) { return MinerPaths.ccminer_cryptonight; } return MinerPaths.ccminer_tpruvot; }
public Algorithm(AlgorithmType niceHashID, string minerName) { NiceHashID = niceHashID; MinerName = minerName; BenchmarkSpeed = 0.0d; ExtraLaunchParameters = ""; LessThreads = 0; Skip = false; BenchmarkStatus = ""; }
/// <summary> /// Creates an instance of the class, initializing /// it with the wrapped object, which is immediately /// serialized and encrypted. /// </summary> /// <remarks> /// <para> /// The wrappedObject must be marked with the Serializable attribute. /// </para><para> /// The IV value is randomly generated. /// </para> /// </remarks> /// <param name="wrappedObject">The object to be encrypted</param> /// <param name="calg">Type of algorithm to use for encryption</param> /// <param name="base64Key">Base64 encoded byte array containing the encryption key</param> public CryptoWrapper(object wrappedObject, AlgorithmType calg, string base64Key) { BinaryFormatter formatter = new BinaryFormatter(); MemoryStream buffer = new MemoryStream(); formatter.Serialize(buffer, wrappedObject); SymmetricAlgorithm crypto = Algorithm(calg); // encrypt here mIV = CreateBase64IV(crypto); buffer = new MemoryStream(Encrypt(buffer.ToArray(), crypto, base64Key, mIV)); mObject = buffer.ToArray(); }
public Algorithm(AlgorithmType niceHashID, string minerName) { NiceHashID = niceHashID; NiceHashName = AlgorithmNiceHashNames.GetName(niceHashID); MinerName = minerName; BenchmarkSpeed = 0.0d; ExtraLaunchParameters = ""; Intensity = 0.0d; // 0.0d is default LessThreads = 0; Skip = false; BenchmarkStatus = ""; }
public Simulation(RenderWindow window, AlgorithmType algoType, GridType gridType, Vector2i nodeSize) { m_Window = window; m_Window.MouseButtonPressed += MousePressedEvent; m_Window.MouseMoved += MouseMovedEvent; SimulationAction = SimulationAction.None; m_NodeSize = nodeSize; m_AlgorithmType = algoType; m_GridType = gridType; RebuildGraph(); }
public Stock() { m_Name = string.Empty; m_Number = string.Empty; m_Type = StockType.Observed; m_BuyPrice = 0; m_SellPrice = 0; m_ObservedPrice = 0; m_CurrentPrice = 0; m_ExpectBuyPrice = 0; m_ExpectSellPrice = 0; m_AlgType = AlgorithmType.DefinedPrice; }
/// <summary> /// Verifies the hash. /// </summary> /// <param name="source">The source.</param> /// <param name="hashAlgorithm">The hash algorithm.</param> /// <param name="hashValue">The hash value.</param> /// <returns><c>true</c> if the 2 hashed values match, <c>false</c> otherwise.</returns> public static bool VerifyHash(object source, AlgorithmType hashAlgorithm, string hashValue) { if (source == null) throw new Exception(nameof(source) + " cannot be null"); MemoryStream memoryStream = new MemoryStream(); BinaryFormatter binaryFormatter = new BinaryFormatter(); lock (Locker) { binaryFormatter.Serialize(memoryStream, source); } return PlainTextHashGenerator.VerifyHash(Convert.ToBase64String(memoryStream.ToArray()), hashAlgorithm, hashValue); }
public static IAlgorithm BuildAlgorithm(AlgorithmType algorithmType) { // Algorithms for MsData if (DataSourceType == DataSourceType.MsData) { switch (algorithmType) { case AlgorithmType.FpGrowth: return new MsWebFpGrowthAlgorithm(); case AlgorithmType.Apriori: return new MsWebAprioriAlgorithm(); } } throw new Exception("Wrong setting!"); }
public static BaseMatcher CreateMatcher(AlgorithmType algorithmType, string patternText, RegexOptionsEx options) { switch (algorithmType) { case AlgorithmType.ExplicitDFA: return new ExplicitDFAMatcher(patternText, options); case AlgorithmType.ImplicitDFA: return new ImplicitDFAMatcher(patternText, options); case AlgorithmType.Backtracking: return new BacktrackingMatcher(patternText, options); default: throw new NotImplementedException("Algorithm not yet implemented."); } }
public static ISort GetSortingAlgorithm(AlgorithmType algorithmType) { switch (algorithmType) { case AlgorithmType.QuickSort: return new QuickSort(); case AlgorithmType.MergeSort: return new MergeSort(); case AlgorithmType.InsertionSort: return new InsertionSort(); case AlgorithmType.BubbleSort: return new BubbleSort(); case AlgorithmType.HeapSort: return new HeapSort(); default: throw new Exception("Invalid AlgorithmType"); } }
public static void AreMatchesSameAsMsoft(string input, string pattern, AlgorithmType algorithmType, RegexOptions options) { //DisplayPattern(pattern); Match2[] actual = new Regex2(pattern, algorithmType, options).Matches(input).ToArray(); DisplayMatches(input, pattern, algorithmType, options, actual); Match2[] expected = CreateMatches(Msoft.Regex.Matches(input, pattern, ToMsoftRegexOptions(options))); try { CollectionAssert.AreEqual(expected, actual); } catch (Exception ex) { throw new AssertionException(formatException(input, pattern, options, ex)); } }
public static Random Create(AlgorithmType algorithm = AlgorithmType.Default) { switch(algorithm) { case AlgorithmType.LCG: return new CompatilizedRandom(new LCG()); case AlgorithmType.MersenneTwister: return new CompatilizedRandom(new MersenneTwister()); case AlgorithmType.MotherOfAll: return new CompatilizedRandom(new MotherOfAll()); case AlgorithmType.RanrotB: return new CompatilizedRandom(new RanrotB()); case AlgorithmType.SFMT: return new CompatilizedRandom(new SFMT()); case AlgorithmType.Well: return new CompatilizedRandom(new Well()); case AlgorithmType.Xorshift: return new CompatilizedRandom(new Xorshift()); default: return new Random(); } }
public AuthKey(string uriString) { var uri = new Uri(uriString); if (uri.Scheme != "otpauth") throw new ArgumentException("URI not of type otpauth."); this.Type = parseAuthType(uri); this.Label = HttpUtility.UrlDecode(uri.AbsolutePath.Substring(1)); var parameters = HttpUtility.ParseQueryString(uri.Query); this.Key = parseKey(parameters); this.NumDigits = parseNumDigits(parameters); this._algorithmType = parseAlgorithm(parameters); if (this.Type == AuthType.TOTP) this.Period = parsePeriod(parameters); else this.Counter = parseCounter(parameters); }
public void CreateSolver(AlgorithmType algoType, IIndexedPathfindingMap map, double heuristic, out IPathFinder<Vector2i> pathFinder, out IPathFindingListener<Vector2i> listener) { switch (algoType) { case AlgorithmType.AStar: listener = new AStarListener(); pathFinder = new AStar<Vector2i>(map.GetNeighbors, map.DistanceEstimate, heuristic) { Listener = (IAStarListener<Vector2i>)listener }; return; case AlgorithmType.Dijkstra: listener = new DijkstraListener(); pathFinder = new Dijkstra<Vector2i>(map.GetNeighbors, map.DistanceEstimate) { Listener = listener }; return; } throw new Exception($"Unrecognized algorithm type: {algoType}"); }
// TODO remove somehow /// <summary> /// GetOptimizedMinerPath returns optimized miner path based on algorithm type and device codename. /// Device codename is a quickfix for sgminer, other miners don't use it /// </summary> /// <param name="algorithmType">determines what miner path to return</param> /// <param name="devCodename">sgminer extra</param> /// <param name="isOptimized">sgminer extra</param> /// <returns></returns> protected string GetOptimizedMinerPath(AlgorithmType algorithmType, string devCodename = "", bool isOptimized = true) { return(MinerPaths.GetOptimizedMinerPath(algorithmType, DeviceType, DeviceGroupType, devCodename, isOptimized)); }
public static string ParseForMiningPair(MiningPair miningPair, AlgorithmType algorithmType, DeviceType deviceType, bool showLog = true) { return ParseForMiningPairs( new List<MiningPair>() { miningPair }, algorithmType, deviceType, MinerPaths.GetOptimizedMinerPath(miningPair), showLog); }
/// <summary> /// Verifies the hash. /// </summary> /// <param name="value">The value.</param> /// <param name="hashedValue">The hashed value.</param> /// <param name="algorithmType">Type of the algorithm.</param> /// <returns><c>true</c> if the 2 hashed values match, <c>false</c> otherwise.</returns> public static bool VerifyHash(this string value, string hashedValue, AlgorithmType algorithmType) { return PlainTextHashGenerator.VerifyHash(value, algorithmType, hashedValue); }
public static string GetLocationUrl(AlgorithmType algorithmType, string miningLocation, NhmConectionType conectionType) { var name = GetAlgorithmUrlName(algorithmType); // if name is empty return if (name == "") { return(""); } var nPort = 3333 + algorithmType; var sslPort = 30000 + nPort; // NHMConectionType.NONE var prefix = ""; var port = nPort; switch (conectionType) { case NhmConectionType.LOCKED: return(miningLocation); case NhmConectionType.STRATUM_TCP: prefix = "stratum+tcp://"; break; case NhmConectionType.STRATUM_SSL: prefix = "stratum+ssl://"; port = sslPort; break; } #if CUSTOM_ENDPOINTS var customEndpointTemplateEntry = _stratumEndpointTemplatesByAlgorithmType[algorithmType]; var customPort = customEndpointTemplateEntry.Port; if (conectionType == NhmConectionType.STRATUM_SSL) { customPort = customPort + 30000; } var customEndpointTemplate = customEndpointTemplateEntry.Template; customEndpointTemplate = customEndpointTemplate.Replace(PREFIX_TEMPLATE, prefix); customEndpointTemplate = customEndpointTemplate.Replace(LOCATION_TEMPLATE, miningLocation); customEndpointTemplate = customEndpointTemplate.Replace(PORT_TEMPLATE, $":{customPort}"); return(customEndpointTemplate); #elif TESTNET return(prefix + name + "-test." + miningLocation + ".nicehash.com:" + port); #elif TESTNETDEV return(prefix + "stratum-test." + miningLocation + ".nicehash.com:" + port); #elif PRODUCTION_NEW return(prefix + name + "." + miningLocation + "-new.nicehash.com:" + port); #else return(prefix + name + "." + miningLocation + ".nicehash.com:" + port); #endif }
/// <summary> /// Verifies the hash. /// </summary> /// <param name="value">The value.</param> /// <param name="hashedValue">The hashed value.</param> /// <param name="algorithmType">Type of the algorithm.</param> /// <returns><c>true</c> if the 2 hashed values match, <c>false</c> otherwise.</returns> public static bool VerifyHash(this object value, string hashedValue, AlgorithmType algorithmType) { return ObjectHashGenerator.VerifyHash(value, algorithmType, hashedValue); }
protected virtual string AlgorithmName(AlgorithmType algorithmType) => PluginSupportedAlgorithms.AlgorithmName(algorithmType);
protected string GetServiceUrl(AlgorithmType algo) { return(Globals.GetLocationUrl(algo, Globals.MiningLocation[ConfigManager.GeneralConfig.ServiceLocation], ConectionType)); }
protected static HashAlgorithm Algorithm(AlgorithmType type, string base64Key) { switch (type) { case AlgorithmType.SHA1: return SHA1CryptoServiceProvider.Create(); case AlgorithmType.MD5: return MD5CryptoServiceProvider.Create(); case AlgorithmType.SHA256: return SHA256Managed.Create(); case AlgorithmType.SHA384: return SHA384Managed.Create(); case AlgorithmType.SHA512: return SHA512Managed.Create(); case AlgorithmType.RIPEMD160: return System.Security.Cryptography.RIPEMD160Managed.Create(); default: return new HMACSHA1(Convert.FromBase64String(base64Key)); } }
protected BasePredictor(LotteryInfoDto lotteryInfo, AlgorithmType algorithmType) { _LotteryInfo = lotteryInfo; AlgorithmType = algorithmType; }
public static string GetName(AlgorithmType type) { return(_names[type]); }
public QuantifierMatcherTests(AlgorithmType algorithmType) : base(algorithmType) { }
/// <summary>Retrieve the appropriate HashAlgorithm for a given AlgorithmType.</summary> /// <param name="type">The AlgorithmType to derive a HashAlgorithm from.</param> /// <returns>The corresponding HashAlgorithm.</returns> static public System.Security.Cryptography.HashAlgorithm GetHasherFromType(AlgorithmType type) { switch (type) { case AlgorithmType.ADLER32: return(new Classless.Hasher.Adler32()); case AlgorithmType.CKSUM: return(new Classless.Hasher.Cksum()); case AlgorithmType.CRC16: return(new Classless.Hasher.CRC(Classless.Hasher.CRCParameters.GetParameters(Classless.Hasher.CRCStandard.CRC16))); case AlgorithmType.CRC16ARC: return(new Classless.Hasher.CRC(Classless.Hasher.CRCParameters.GetParameters(Classless.Hasher.CRCStandard.CRC16_ARC))); case AlgorithmType.CRC16CCITT: return(new Classless.Hasher.CRC(Classless.Hasher.CRCParameters.GetParameters(Classless.Hasher.CRCStandard.CRC16_CCITT))); case AlgorithmType.CRC16CCITTREVERSED: return(new Classless.Hasher.CRC(Classless.Hasher.CRCParameters.GetParameters(Classless.Hasher.CRCStandard.CRC16_CCITT_REVERSED))); case AlgorithmType.CRC16REVERSED: return(new Classless.Hasher.CRC(Classless.Hasher.CRCParameters.GetParameters(Classless.Hasher.CRCStandard.CRC16_REVERSED))); case AlgorithmType.CRC16ZMODEM: return(new Classless.Hasher.CRC(Classless.Hasher.CRCParameters.GetParameters(Classless.Hasher.CRCStandard.CRC16_ZMODEM))); case AlgorithmType.CRC32: return(new Classless.Hasher.CRC(Classless.Hasher.CRCParameters.GetParameters(Classless.Hasher.CRCStandard.CRC32))); case AlgorithmType.CRC32BZIP2: return(new Classless.Hasher.CRC(Classless.Hasher.CRCParameters.GetParameters(Classless.Hasher.CRCStandard.CRC32_BZIP2))); case AlgorithmType.CRC32JAMCRC: return(new Classless.Hasher.CRC(Classless.Hasher.CRCParameters.GetParameters(Classless.Hasher.CRCStandard.CRC32_JAMCRC))); case AlgorithmType.CRC32REVERSED: return(new Classless.Hasher.CRC(Classless.Hasher.CRCParameters.GetParameters(Classless.Hasher.CRCStandard.CRC32_REVERSED))); case AlgorithmType.CRC8: return(new Classless.Hasher.CRC(Classless.Hasher.CRCParameters.GetParameters(Classless.Hasher.CRCStandard.CRC8))); case AlgorithmType.CRC8REVERSED: return(new Classless.Hasher.CRC(Classless.Hasher.CRCParameters.GetParameters(Classless.Hasher.CRCStandard.CRC8_REVERSED))); case AlgorithmType.ELFHASH: return(new Classless.Hasher.ElfHash()); case AlgorithmType.FCS16: return(new Classless.Hasher.FCS16()); case AlgorithmType.FCS32: return(new Classless.Hasher.FCS32()); case AlgorithmType.FNV032: return(new Classless.Hasher.FNV(Classless.Hasher.FNVParameters.GetParameters(Classless.Hasher.FNVStandard.FNV0_32))); case AlgorithmType.FNV064: return(new Classless.Hasher.FNV(Classless.Hasher.FNVParameters.GetParameters(Classless.Hasher.FNVStandard.FNV0_64))); case AlgorithmType.FNV132: return(new Classless.Hasher.FNV(Classless.Hasher.FNVParameters.GetParameters(Classless.Hasher.FNVStandard.FNV1_32))); case AlgorithmType.FNV164: return(new Classless.Hasher.FNV(Classless.Hasher.FNVParameters.GetParameters(Classless.Hasher.FNVStandard.FNV1_64))); case AlgorithmType.FNV1A32: return(new Classless.Hasher.FNV(Classless.Hasher.FNVParameters.GetParameters(Classless.Hasher.FNVStandard.FNV1A_32))); case AlgorithmType.FNV1A64: return(new Classless.Hasher.FNV(Classless.Hasher.FNVParameters.GetParameters(Classless.Hasher.FNVStandard.FNV1A_64))); case AlgorithmType.GHASH3: return(new Classless.Hasher.GHash(Classless.Hasher.GHashParameters.GetParameters(Classless.Hasher.GHashStandard.GHash_3))); case AlgorithmType.GHASH5: return(new Classless.Hasher.GHash(Classless.Hasher.GHashParameters.GetParameters(Classless.Hasher.GHashStandard.GHash_5))); case AlgorithmType.GOSTHASH: return(new Classless.Hasher.GOSTHash()); case AlgorithmType.HAVAL3128: return(new Classless.Hasher.HAVAL(Classless.Hasher.HAVALParameters.GetParameters(Classless.Hasher.HAVALStandard.HAVAL_3_128))); case AlgorithmType.HAVAL3160: return(new Classless.Hasher.HAVAL(Classless.Hasher.HAVALParameters.GetParameters(Classless.Hasher.HAVALStandard.HAVAL_3_160))); case AlgorithmType.HAVAL3192: return(new Classless.Hasher.HAVAL(Classless.Hasher.HAVALParameters.GetParameters(Classless.Hasher.HAVALStandard.HAVAL_3_192))); case AlgorithmType.HAVAL3224: return(new Classless.Hasher.HAVAL(Classless.Hasher.HAVALParameters.GetParameters(Classless.Hasher.HAVALStandard.HAVAL_3_224))); case AlgorithmType.HAVAL3256: return(new Classless.Hasher.HAVAL(Classless.Hasher.HAVALParameters.GetParameters(Classless.Hasher.HAVALStandard.HAVAL_3_256))); case AlgorithmType.HAVAL4128: return(new Classless.Hasher.HAVAL(Classless.Hasher.HAVALParameters.GetParameters(Classless.Hasher.HAVALStandard.HAVAL_4_128))); case AlgorithmType.HAVAL4160: return(new Classless.Hasher.HAVAL(Classless.Hasher.HAVALParameters.GetParameters(Classless.Hasher.HAVALStandard.HAVAL_4_160))); case AlgorithmType.HAVAL4192: return(new Classless.Hasher.HAVAL(Classless.Hasher.HAVALParameters.GetParameters(Classless.Hasher.HAVALStandard.HAVAL_4_192))); case AlgorithmType.HAVAL4224: return(new Classless.Hasher.HAVAL(Classless.Hasher.HAVALParameters.GetParameters(Classless.Hasher.HAVALStandard.HAVAL_4_224))); case AlgorithmType.HAVAL4256: return(new Classless.Hasher.HAVAL(Classless.Hasher.HAVALParameters.GetParameters(Classless.Hasher.HAVALStandard.HAVAL_4_256))); case AlgorithmType.HAVAL5128: return(new Classless.Hasher.HAVAL(Classless.Hasher.HAVALParameters.GetParameters(Classless.Hasher.HAVALStandard.HAVAL_5_128))); case AlgorithmType.HAVAL5160: return(new Classless.Hasher.HAVAL(Classless.Hasher.HAVALParameters.GetParameters(Classless.Hasher.HAVALStandard.HAVAL_5_160))); case AlgorithmType.HAVAL5192: return(new Classless.Hasher.HAVAL(Classless.Hasher.HAVALParameters.GetParameters(Classless.Hasher.HAVALStandard.HAVAL_5_192))); case AlgorithmType.HAVAL5224: return(new Classless.Hasher.HAVAL(Classless.Hasher.HAVALParameters.GetParameters(Classless.Hasher.HAVALStandard.HAVAL_5_224))); case AlgorithmType.HAVAL5256: return(new Classless.Hasher.HAVAL(Classless.Hasher.HAVALParameters.GetParameters(Classless.Hasher.HAVALStandard.HAVAL_5_256))); case AlgorithmType.JHASH: return(new Classless.Hasher.JHash()); case AlgorithmType.MD2: return(new Classless.Hasher.MD2()); case AlgorithmType.MD4: return(new Classless.Hasher.MD4()); case AlgorithmType.MD5: return(new Classless.Hasher.MD5()); case AlgorithmType.RIPEMD128: return(new Classless.Hasher.RIPEMD128()); case AlgorithmType.RIPEMD160: return(new Classless.Hasher.RIPEMD160()); case AlgorithmType.RIPEMD256: return(new Classless.Hasher.RIPEMD256()); case AlgorithmType.RIPEMD320: return(new Classless.Hasher.RIPEMD320()); case AlgorithmType.SHA0: return(new Classless.Hasher.SHA0()); case AlgorithmType.SHA1: return(new Classless.Hasher.SHA1()); case AlgorithmType.SHA224: return(new Classless.Hasher.SHA224()); case AlgorithmType.SHA256: return(new Classless.Hasher.SHA256()); case AlgorithmType.SHA384: return(new Classless.Hasher.SHA384()); case AlgorithmType.SHA512: return(new Classless.Hasher.SHA512()); case AlgorithmType.SNEFRU24128: return(new Classless.Hasher.Snefru2(Classless.Hasher.Snefru2Parameters.GetParameters(Classless.Hasher.Snefru2Standard.Snefru2_4_128))); case AlgorithmType.SNEFRU28128: return(new Classless.Hasher.Snefru2(Classless.Hasher.Snefru2Parameters.GetParameters(Classless.Hasher.Snefru2Standard.Snefru2_8_128))); case AlgorithmType.SNEFRU24256: return(new Classless.Hasher.Snefru2(Classless.Hasher.Snefru2Parameters.GetParameters(Classless.Hasher.Snefru2Standard.Snefru2_4_256))); case AlgorithmType.SNEFRU28256: return(new Classless.Hasher.Snefru2(Classless.Hasher.Snefru2Parameters.GetParameters(Classless.Hasher.Snefru2Standard.Snefru2_8_256))); case AlgorithmType.SUMBSD: return(new Classless.Hasher.SumBSD()); case AlgorithmType.SUMSYSV: return(new Classless.Hasher.SumSysV()); case AlgorithmType.TIGER: return(new Classless.Hasher.Tiger()); case AlgorithmType.WHIRLPOOL: return(new Classless.Hasher.Whirlpool()); case AlgorithmType.XUM32: return(new Classless.Hasher.XUM32()); default: throw new System.NotSupportedException("Unsupported algorithm type."); } }
public static Miner CreateMiner(DeviceType deviceType, AlgorithmType algorithmType, MinerBaseType minerBaseType, AlgorithmType secondaryAlgorithmType = AlgorithmType.NONE) { switch (minerBaseType) { case MinerBaseType.ccminer: return(new Ccminer()); case MinerBaseType.ccminer_22: return(new Ccminer()); /*case MinerBaseType.ccminer_alexis_hsr: * return new Ccminer();*/ case MinerBaseType.ccminer_alexis78: return(new Ccminer()); case MinerBaseType.ccminer_klaust818: return(new Ccminer()); case MinerBaseType.ccminer_polytimos: return(new Ccminer()); case MinerBaseType.ccminer_xevan: return(new Ccminer()); case MinerBaseType.ccminer_palgin: return(new Ccminer()); case MinerBaseType.ccminer_skunkkrnlx: return(new Ccminer()); case MinerBaseType.ccminer_tpruvot2: return(new Ccminer()); case MinerBaseType.sgminer: return(new Sgminer()); case MinerBaseType.GatelessGate: return(new Glg()); case MinerBaseType.nheqminer: return(new Nheqminer()); case MinerBaseType.ethminer: return(CreateEthminer(deviceType)); case MinerBaseType.Claymore: return(CreateClaymore(algorithmType, secondaryAlgorithmType)); case MinerBaseType.OptiminerAMD: return(new OptiminerZcashMiner()); case MinerBaseType.excavator: return(new Excavator()); case MinerBaseType.XmrStackCPU: return(new XmrStackCPUMiner()); case MinerBaseType.ccminer_alexis: return(new Ccminer()); case MinerBaseType.experimental: return(CreateExperimental(deviceType, algorithmType)); case MinerBaseType.EWBF: return(new EWBF()); case MinerBaseType.DSTM: return(new DSTM()); case MinerBaseType.Prospector: return(new Prospector()); case MinerBaseType.Xmrig: return(new Xmrig()); case MinerBaseType.XmrStakAMD: return(new XmrStakAMD()); case MinerBaseType.Claymore_old: return(new ClaymoreCryptoNightMiner(true)); case MinerBaseType.hsrneoscrypt: return(new Hsrneoscrypt()); /*case MinerBaseType.hsrneoscrypt_hsr: * return new Hsrneoscrypt_hsr();*/ //case MinerBaseType.mkxminer: // return new Mkxminer(); } return(null); }
public Form_Benchmark(BenchmarkPerformanceType benchmarkPerformanceType = BenchmarkPerformanceType.Standard, bool autostart = false, //List<ComputeDevice> enabledDevices = null, AlgorithmType singleBenchmarkType = AlgorithmType.NONE) { InitializeComponent(); this.Icon = NiceHashMiner.Properties.Resources.logo; _singleBenchmarkType = singleBenchmarkType; benchmarkOptions1.SetPerformanceType(benchmarkPerformanceType); // benchmark only unique devices devicesListViewEnableControl1.SetIListItemCheckColorSetter(this); devicesListViewEnableControl1.SetComputeDevices(ComputeDeviceManager.Avaliable.AllAvaliableDevices); // use this to track miner benchmark statuses _benchmarkMiners = new List <Miner>(); InitLocale(); _benchmarkingTimer = new Timer(); _benchmarkingTimer.Tick += BenchmarkingTimer_Tick; _benchmarkingTimer.Interval = 1000; // 1s // name, UUID Dictionary <string, string> benchNamesUUIDs = new Dictionary <string, string>(); // initialize benchmark settings for same cards to only copy settings foreach (var cDev in ComputeDeviceManager.Avaliable.AllAvaliableDevices) { var plainDevName = cDev.Name; if (benchNamesUUIDs.ContainsKey(plainDevName)) { cDev.Enabled = false; cDev.BenchmarkCopyUUID = benchNamesUUIDs[plainDevName]; } else { benchNamesUUIDs.Add(plainDevName, cDev.UUID); cDev.Enabled = true; // enable benchmark cDev.BenchmarkCopyUUID = null; } } //groupBoxAlgorithmBenchmarkSettings.Enabled = _singleBenchmarkType == AlgorithmType.NONE; devicesListViewEnableControl1.Enabled = _singleBenchmarkType == AlgorithmType.NONE; devicesListViewEnableControl1.SetDeviceSelectionChangedCallback(devicesListView1_ItemSelectionChanged); devicesListViewEnableControl1.SetAlgorithmsListView(algorithmsListView1); devicesListViewEnableControl1.IsBenchmarkForm = true; devicesListViewEnableControl1.IsSettingsCopyEnabled = true; ResetBenchmarkProgressStatus(); CalcBenchmarkDevicesAlgorithmQueue(); devicesListViewEnableControl1.ResetListItemColors(); // to update laclulation status devicesListViewEnableControl1.BenchmarkCalculation = this; algorithmsListView1.BenchmarkCalculation = this; // set first device selected { if (ComputeDeviceManager.Avaliable.AllAvaliableDevices.Count > 0) { var firstComputedevice = ComputeDeviceManager.Avaliable.AllAvaliableDevices[0]; algorithmsListView1.SetAlgorithms(firstComputedevice, firstComputedevice.Enabled); } if (autostart) { ExitWhenFinished = true; StartStopBtn_Click(null, null); } }
/// <summary> /// Creates the encryptor. /// </summary> /// <param name="algType">Type of the alg.</param> /// <param name="key">The key.</param> /// <param name="entropy">The entropy.</param> /// <returns></returns> public static Wrapper CreateEncryptor(AlgorithmType algType, byte [] key, int entropy = 50) { SymmetricAlgorithm algorithm = null; switch (algType) { case AlgorithmType.AES: algorithm = new AesCryptoServiceProvider(); break; case AlgorithmType.DES: algorithm = new DESCryptoServiceProvider(); break; case AlgorithmType.TripleDES: algorithm = new TripleDESCryptoServiceProvider(); break; } Rfc2898DeriveBytes db = new Rfc2898DeriveBytes(key, algorithm.IV, entropy); algorithm.Key = db.GetBytes(algorithm.KeySize / 8); return new Wrapper(algorithm, algorithm.CreateEncryptor()); }
public MinerPath(AlgorithmType algo, string path) { Algorithm = algo; Path = path; Name = Algorithm.ToString(); }
public static Miner CreateMiner(DeviceType deviceType, AlgorithmType algorithmType, MinerBaseType minerBaseType, AlgorithmType secondaryAlgorithmType = AlgorithmType.NONE) { switch (minerBaseType) { case MinerBaseType.ccminer: return(new ccminer()); case MinerBaseType.sgminer: return(new sgminer()); case MinerBaseType.nheqminer: return(new nheqminer()); case MinerBaseType.ethminer: return(CreateEthminer(deviceType)); case MinerBaseType.Claymore: return(CreateClaymore(algorithmType, secondaryAlgorithmType)); case MinerBaseType.OptiminerAMD: return(new OptiminerZcashMiner()); case MinerBaseType.excavator: return(new excavator()); case MinerBaseType.XmrStackCPU: return(new XmrStackCPUMiner()); case MinerBaseType.ccminer_alexis: return(new ccminer()); case MinerBaseType.experimental: return(CreateExperimental(deviceType, algorithmType)); case MinerBaseType.EWBF: return(new EWBF()); case MinerBaseType.Prospector: return(new Prospector()); case MinerBaseType.Xmrig: return(new Xmrig()); } return(null); }
public void SaveMoveConfig(DeviceType deviceType, AlgorithmType algorithmType, string sourcePath) { lock (_configsLock) { try { string destinationPath = Path.Combine(GetMinerConfigsRoot(), $"{algorithmType.ToString()}_{deviceType.ToString()}.txt"); var dirPath = Path.GetDirectoryName(destinationPath); if (Directory.Exists(dirPath) == false) { Directory.CreateDirectory(dirPath); } var readConfigContent = File.ReadAllText(sourcePath); // make it JSON readConfigContent = "{" + readConfigContent + "}"; // remove old if any if (File.Exists(destinationPath)) { File.Delete(destinationPath); } // move to path File.Move(sourcePath, destinationPath); var cachedFileSettings = $"cached_{algorithmType.ToString()}_{deviceType.ToString()}.json"; var cachedFileSettingsPath = Path.Combine(GetMinerConfigsRoot(), cachedFileSettings); var uuids = _registeredDeviceUUIDTypes.Where(kvp => kvp.Value == deviceType).Select(kvp => kvp.Key).ToList(); object cachedSettings = null; //TODO load and save switch (deviceType) { case DeviceType.CPU: var cpuConfig = JsonConvert.DeserializeObject <CpuConfig>(readConfigContent); SetCpuConfig(algorithmType, cpuConfig); cachedSettings = new CachedCpuSettings { CachedConfig = cpuConfig, DeviceUUIDs = uuids }; break; case DeviceType.AMD: var amdConfig = JsonConvert.DeserializeObject <AmdConfig>(readConfigContent); SetAmdConfig(algorithmType, amdConfig); cachedSettings = new CachedAmdSettings { CachedConfig = amdConfig, DeviceUUIDs = uuids }; break; case DeviceType.NVIDIA: var nvidiaConfig = JsonConvert.DeserializeObject <NvidiaConfig>(readConfigContent); SetNvidiaConfig(algorithmType, nvidiaConfig); cachedSettings = new CachedNvidiaSettings { CachedConfig = nvidiaConfig, DeviceUUIDs = uuids }; break; } if (cachedSettings != null) { var header = "// This config file was autogenerated by NHML."; header += "\n// \"DeviceUUIDs\" is used to check if we have same devices and should not be edited."; header += "\n// \"CachedConfig\" can be edited as it is used as config template (edit this only if you know what you are doing)"; header += "\n// If \"DeviceUUIDs\" is different (new devices added or old ones removed) this file will be overwritten and \"CachedConfig\" will be set to defaults."; header += "\n\n"; var jsonText = JsonConvert.SerializeObject(cachedSettings, Formatting.Indented); var headerWithConfigs = header + jsonText; InternalConfigs.WriteFileSettings(cachedFileSettingsPath, headerWithConfigs); } } catch (Exception e) { Logger.Error("XmrStakRxPlugin", $"SaveMoveConfig error: {e.Message}"); } } }
public static string FormatDualSpeedOutput(double primarySpeed, double secondarySpeed = 0, AlgorithmType algo = AlgorithmType.NONE) { string ret; if (secondarySpeed > 0) { ret = FormatSpeedOutput(primarySpeed, "") + "/" + FormatSpeedOutput(secondarySpeed, "") + " "; } else { ret = FormatSpeedOutput(primarySpeed); } var unit = (algo == AlgorithmType.Equihash) ? "Sol/s " : "H/s "; return(ret + unit); }
private bool IsDaggerOrKawpow(AlgorithmType algorithmType) { return(algorithmType == AlgorithmType.DaggerHashimoto || algorithmType == AlgorithmType.KAWPOW); }
private static MinerType GetMinerType(DeviceType deviceType, MinerBaseType minerBaseType, AlgorithmType algorithmType) { //if (MinerBaseType.cpuminer == minerBaseType) { // return MinerType.cpuminer_opt; //} switch (minerBaseType) { //case MinerBaseType.OptiminerAMD: // return MinerType.OptiminerZcash; case MinerBaseType.sgminer: return(MinerType.sgminer); case MinerBaseType.ccminer: case MinerBaseType.ccminer_alexis: case MinerBaseType.experimental: if (AlgorithmType.CryptoNight_UNUSED == algorithmType) { return(MinerType.ccminer_CryptoNight); } return(MinerType.ccminer); case MinerBaseType.Claymore: switch (algorithmType) { case AlgorithmType.CryptoNight_UNUSED: return(MinerType.ClaymoreCryptoNight); //case AlgorithmType.Equihash: // return MinerType.ClaymoreZcash; case AlgorithmType.DaggerHashimoto: return(MinerType.ClaymoreDual); } break; case MinerBaseType.Claymore_old: if (AlgorithmType.CryptoNight_UNUSED == algorithmType) { return(MinerType.ClaymoreCryptoNight); } break; case MinerBaseType.ethminer: if (DeviceType.AMD == deviceType) { return(MinerType.ethminer_OCL); } if (DeviceType.NVIDIA == deviceType) { return(MinerType.ethminer_CUDA); } break; //case MinerBaseType.nheqminer: // switch (deviceType) // { // case DeviceType.CPU: // return MinerType.nheqminer_CPU; // case DeviceType.AMD: // return MinerType.nheqminer_AMD; // case DeviceType.NVIDIA: // return MinerType.nheqminer_CUDA; // } // break; //case MinerBaseType.eqm: // if (DeviceType.CPU == deviceType) // { // return MinerType.eqm_CPU; // } // if (DeviceType.NVIDIA == deviceType) // { // return MinerType.eqm_CUDA; // } // break; //case MinerBaseType.excavator: // return MinerType.excavator; case MinerBaseType.EWBF: return(MinerType.EWBF); //case MinerBaseType.Xmrig: // return MinerType.Xmrig; //case MinerBaseType.dtsm: // return MinerType.dtsm; //case MinerBaseType.cpuminer: // return MinerType.cpuminer_opt; case MinerBaseType.trex: return(MinerType.trex); case MinerBaseType.Phoenix: return(MinerType.Phoenix); case MinerBaseType.GMiner: return(MinerType.GMiner); case MinerBaseType.BMiner: return(MinerType.BMiner); } return(MinerType.NONE); }
public static string ParseForMiningPairs(List <MiningPair> MiningPairs, DeviceType deviceType, bool showLog = true) { _showLog = showLog; MinerBaseType minerBaseType = MinerBaseType.NONE; AlgorithmType algorithmType = AlgorithmType.NONE; if (MiningPairs.Count > 0) { var algo = MiningPairs[0].Algorithm; if (algo != null) { algorithmType = algo.NiceHashID; minerBaseType = algo.MinerBaseType; } } MinerType minerType = GetMinerType(deviceType, minerBaseType, algorithmType); MinerOptionPackage minerOptionPackage = ExtraLaunchParameters.GetMinerOptionPackageForMinerType(minerType); List <MiningPair> setMiningPairs = MiningPairs.ConvertAll((mp) => mp); // handle exceptions and package parsing // CPU exception if (deviceType == DeviceType.CPU && minerType != MinerType.Xmrig) { CheckAndSetCPUPairs(setMiningPairs); } // ethminer exception if (MinerType.ethminer_OCL == minerType || MinerType.ethminer_CUDA == minerType) { // use if missing compute device for correct mapping // init fakes workaround var cdevs_mappings = new List <MiningPair>(); { int id = -1; var fakeAlgo = new Algorithm(MinerBaseType.ethminer, AlgorithmType.DaggerHashimoto, "daggerhashimoto"); foreach (var pair in setMiningPairs) { while (++id != pair.Device.ID) { var fakeCdev = new ComputeDevice(id); cdevs_mappings.Add(new MiningPair(fakeCdev, fakeAlgo)); } cdevs_mappings.Add(pair); } } // reset setMiningPairs setMiningPairs = cdevs_mappings; } // sgminer exception handle intensity types if (MinerType.sgminer == minerType) { // rawIntensity overrides xintensity, xintensity overrides intensity var sgminer_intensities = new List <MinerOption>() { new MinerOption("Intensity", "-I", "--intensity", "d", MinerOptionFlagType.MultiParam, ","), // default is "d" check if -1 works new MinerOption("Xintensity", "-X", "--xintensity", "-1", MinerOptionFlagType.MultiParam, ","), // default none new MinerOption("Rawintensity", "", "--rawintensity", "-1", MinerOptionFlagType.MultiParam, ","), // default none }; var contains_intensity = new Dictionary <MinerOptionType, bool>() { { "Intensity", false }, { "Xintensity", false }, { "Rawintensity", false }, }; // check intensity and xintensity, the latter overrides so change accordingly foreach (var cDev in setMiningPairs) { foreach (var intensityOption in sgminer_intensities) { if (!string.IsNullOrEmpty(intensityOption.ShortName) && cDev.CurrentExtraLaunchParameters.Contains(intensityOption.ShortName)) { cDev.CurrentExtraLaunchParameters = cDev.CurrentExtraLaunchParameters.Replace(intensityOption.ShortName, intensityOption.LongName); contains_intensity[intensityOption.Type] = true; } if (cDev.CurrentExtraLaunchParameters.Contains(intensityOption.LongName)) { contains_intensity[intensityOption.Type] = true; } } } // replace if (contains_intensity["Intensity"] && contains_intensity["Xintensity"]) { LogParser("Sgminer replacing --intensity with --xintensity"); foreach (var cDev in setMiningPairs) { cDev.CurrentExtraLaunchParameters = cDev.CurrentExtraLaunchParameters.Replace("--intensity", "--xintensity"); } } if (contains_intensity["Xintensity"] && contains_intensity["Rawintensity"]) { LogParser("Sgminer replacing --xintensity with --rawintensity"); foreach (var cDev in setMiningPairs) { cDev.CurrentExtraLaunchParameters = cDev.CurrentExtraLaunchParameters.Replace("--xintensity", "--rawintensity"); } } } string ret = ""; string general = Parse(setMiningPairs, minerOptionPackage.GeneralOptions, false, minerOptionPackage.TemperatureOptions); // temp control and parse if (ConfigManager.GeneralConfig.DisableAMDTempControl) { LogParser("DisableAMDTempControl is TRUE, temp control parameters will be ignored"); ret = general; } else { LogParser("AMD parsing temperature control parameters"); // temp = Parse(setMiningPairs, minerOptionPackage.TemperatureOptions, true, minerOptionPackage.GeneralOptions); string temp = Parse(setMiningPairs, minerOptionPackage.TemperatureOptions, false, minerOptionPackage.GeneralOptions); ret = general + " " + temp; } return(ret); }
protected virtual string AlgorithmName(AlgorithmType algorithmType) => _algorithmName(algorithmType);
public Regex2(string patternText, AlgorithmType algorithmType) : this(patternText, algorithmType, RegexOptions.None) { }
// NEW START //////////////////////////////////////////// // Pure functions //public static bool IsMinerAlgorithmAvaliable(List<Algorithm> algos, MinerBaseType minerBaseType, AlgorithmType algorithmType) { // return algos.FindIndex((a) => a.MinerBaseType == minerBaseType && a.NiceHashID == algorithmType) > -1; //} public static string GetPathFor(MinerBaseType minerBaseType, AlgorithmType algoType, DeviceGroupType devGroupType, bool def = false) { if (!def & configurableMiners.Contains(minerBaseType)) { // Override with internals var path = minerPathPackages.Find(p => p.DeviceType == devGroupType) .MinerTypes.Find(p => p.Type == minerBaseType) .Algorithms.Find(p => p.Algorithm == algoType); if (path != null) { if (File.Exists(path.Path)) { return(path.Path); } else { Helpers.ConsolePrint("PATHS", String.Format("Path {0} not found, using defaults", path.Path)); } } } switch (minerBaseType) { case MinerBaseType.ccminer: return(NVIDIA_GROUPS.ccminer_path(algoType, devGroupType)); case MinerBaseType.sgminer: return(AMD_GROUP.sgminer_path(algoType)); case MinerBaseType.nheqminer: return(Data.nheqminer); case MinerBaseType.ethminer: return(Data.ethminer); case MinerBaseType.Claymore: return(AMD_GROUP.ClaymorePath(algoType)); case MinerBaseType.OptiminerAMD: return(Data.OptiminerZcashMiner); case MinerBaseType.excavator: return(Data.excavator); case MinerBaseType.XmrStackCPU: return(Data.XmrStackCPUMiner); case MinerBaseType.ccminer_alexis: return(NVIDIA_GROUPS.ccminer_unstable_path(algoType, devGroupType)); case MinerBaseType.experimental: return(EXPERIMENTAL.GetPath(algoType, devGroupType)); case MinerBaseType.EWBF: return(Data.EWBF); case MinerBaseType.ZMiner: return(Data.ZMiner); case MinerBaseType.Prospector: return(Data.prospector); case MinerBaseType.Xmrig: return(Data.Xmrig); case MinerBaseType.XmrStakAMD: return(Data.XmrStakAMD); case MinerBaseType.Claymore_old: return(Data.ClaymoreCryptoNightMiner_old); } return(Data.NONE); }
public static string ParseForCDevs(List <ComputeDevice> CDevs, AlgorithmType algorithmType, DeviceType deviceType, bool showLog = true) { _showLog = showLog; // init cdevs extra launch parameters foreach (var cDev in CDevs) { cDev.CurrentExtraLaunchParameters = cDev.MostProfitableAlgorithm.ExtraLaunchParameters; } // parse for device if (deviceType == DeviceType.NVIDIA) { if (algorithmType != AlgorithmType.DaggerHashimoto && algorithmType != AlgorithmType.CryptoNight) { return(Parse(CDevs, _ccimerOptions)); } else if (algorithmType == AlgorithmType.CryptoNight) { // check if any device is SM21 or SM3.x if yes return empty for stability reasons foreach (var cDev in CDevs) { if (cDev.DeviceGroupType == DeviceGroupType.NVIDIA_2_1 || cDev.DeviceGroupType == DeviceGroupType.NVIDIA_3_x) { return(""); } } return(Parse(CDevs, _ccimerCryptoNightOptions, true)); } else // ethminer dagger // use if missing compute device for correct mapping { int id = -1; var cdevs_mappings = new List <ComputeDevice>(); foreach (var cDev in CDevs) { while (++id != cDev.ID) { var fakeCdev = new ComputeDevice(id, "", "", ""); fakeCdev.CurrentExtraLaunchParameters = ""; // empty cdevs_mappings.Add(fakeCdev); } cdevs_mappings.Add(cDev); } return(Parse(cdevs_mappings, _cudaEthminerOptions)); } } else if (deviceType == DeviceType.AMD) { if (algorithmType != AlgorithmType.DaggerHashimoto) { // rawIntensity overrides xintensity, xintensity overrides intensity var sgminer_intensities = new List <MinerOption>() { new MinerOption(MinerOptionType.Intensity, "-I", "--intensity", "d"), // default is "d" check if -1 works new MinerOption(MinerOptionType.Xintensity, "-X", "--xintensity", "-1"), // default none new MinerOption(MinerOptionType.Rawintensity, "", "--rawintensity", "-1"), // default none }; var contains_intensity = new Dictionary <MinerOptionType, bool>() { { MinerOptionType.Intensity, false }, { MinerOptionType.Xintensity, false }, { MinerOptionType.Rawintensity, false }, }; // check intensity and xintensity, the latter overrides so change accordingly foreach (var cDev in CDevs) { foreach (var intensityOption in sgminer_intensities) { if (!string.IsNullOrEmpty(intensityOption.ShortName) && cDev.CurrentExtraLaunchParameters.Contains(intensityOption.ShortName)) { cDev.CurrentExtraLaunchParameters = cDev.CurrentExtraLaunchParameters.Replace(intensityOption.ShortName, intensityOption.LongName); contains_intensity[intensityOption.Type] = true; } if (cDev.CurrentExtraLaunchParameters.Contains(intensityOption.LongName)) { contains_intensity[intensityOption.Type] = true; } } } // replace if (contains_intensity[MinerOptionType.Intensity] && contains_intensity[MinerOptionType.Xintensity]) { LogParser("Sgminer replacing --intensity with --xintensity"); foreach (var cDev in CDevs) { cDev.CurrentExtraLaunchParameters = cDev.CurrentExtraLaunchParameters.Replace("--intensity", "--xintensity"); } } if (contains_intensity[MinerOptionType.Xintensity] && contains_intensity[MinerOptionType.Rawintensity]) { LogParser("Sgminer replacing --xintensity with --rawintensity"); foreach (var cDev in CDevs) { cDev.CurrentExtraLaunchParameters = cDev.CurrentExtraLaunchParameters.Replace("--xintensity", "--rawintensity"); } } List <MinerOption> sgminerOptionsNew = new List <MinerOption>(); string temperatureControl = ""; // temp control and parse if (ConfigManager.Instance.GeneralConfig.DisableAMDTempControl) { LogParser("DisableAMDTempControl is TRUE, temp control parameters will be ignored"); } else { LogParser("Sgminer parsing temperature control parameters"); temperatureControl = Parse(CDevs, _sgminerTemperatureOptions, true, _sgminerOptions); } LogParser("Sgminer parsing default parameters"); string returnStr = String.Format("{0} {1}", Parse(CDevs, _sgminerOptions, false, _sgminerTemperatureOptions), temperatureControl); LogParser("Sgminer extra launch parameters merged: " + returnStr); return(returnStr); } else // ethminer dagger // use if missing compute device for correct mapping { int id = -1; var cdevs_mappings = new List <ComputeDevice>(); foreach (var cDev in CDevs) { while (++id != cDev.ID) { var fakeCdev = new ComputeDevice(id, "", "", ""); fakeCdev.CurrentExtraLaunchParameters = ""; // empty cdevs_mappings.Add(fakeCdev); } cdevs_mappings.Add(cDev); } return(Parse(cdevs_mappings, _oclEthminerOptions)); } } else if (deviceType == DeviceType.CPU) { foreach (var cDev in CDevs) { // extra thread check if (cDev.CurrentExtraLaunchParameters.Contains("--threads=") || cDev.CurrentExtraLaunchParameters.Contains("-t")) { // nothing } else // add threads params mandatory { cDev.CurrentExtraLaunchParameters += " --threads=" + GetThreads(cDev.Threads, cDev.MostProfitableAlgorithm.LessThreads).ToString(); } } return(Parse(CDevs, _cpuminerOptions)); } return(""); }
public Hashrate(double value, AlgorithmType algo) { Value = value; Algo = algo; }
private void CalculateFactorValue() { InfluencedFactors factor1 = new InfluencedFactors { Name = "天数", AlgorithmIndex = 1, AlgorithmType = AlgorithmType.NONE, PrimaryFactorValue = null }; List <InfluencedFactors> childFactors = new List <InfluencedFactors>() { new InfluencedFactors { Name = "天数", AlgorithmIndex = 1, AlgorithmType = AlgorithmType.NONE, PrimaryFactorValue = 0 }, new InfluencedFactors { Name = "天数", AlgorithmIndex = 2, AlgorithmType = AlgorithmType.ADD, PrimaryFactorValue = 10 }, new InfluencedFactors { Name = "天数", AlgorithmIndex = 3, AlgorithmType = AlgorithmType.SUBTRACT, PrimaryFactorValue = 5, Children = new List <InfluencedFactors> { new InfluencedFactors { Name = "天数", AlgorithmIndex = 1, AlgorithmType = AlgorithmType.NONE, PrimaryFactorValue = 10 }, new InfluencedFactors { Name = "天数", AlgorithmIndex = 1, AlgorithmType = AlgorithmType.DIVIDE, PrimaryFactorValue = 0, Children = new List <InfluencedFactors> { new InfluencedFactors { Name = "天数", AlgorithmIndex = 1, AlgorithmType = AlgorithmType.NONE, PrimaryFactorValue = 3 }, new InfluencedFactors { Name = "天数", AlgorithmIndex = 1, AlgorithmType = AlgorithmType.SUBTRACT, PrimaryFactorValue = 0, Children = new List <InfluencedFactors> { new InfluencedFactors { Name = "天数", AlgorithmIndex = 1, AlgorithmType = AlgorithmType.NONE, PrimaryFactorValue = 3 }, new InfluencedFactors { Name = "天数", AlgorithmIndex = 1, AlgorithmType = AlgorithmType.DIVIDE, PrimaryFactorValue = 0, Children = new List <InfluencedFactors> { new InfluencedFactors { Name = "天数", AlgorithmIndex = 1, AlgorithmType = AlgorithmType.NONE, PrimaryFactorValue = 6 }, new InfluencedFactors { Name = "天数", AlgorithmIndex = 1, AlgorithmType = AlgorithmType.DIVIDE, PrimaryFactorValue = 2 }, } }, } }, } }, } }, new InfluencedFactors { Name = "天数", AlgorithmIndex = 4, AlgorithmType = AlgorithmType.MULTIPLY, PrimaryFactorValue = null, Children = new List <InfluencedFactors> { new InfluencedFactors { Name = "天数", AlgorithmIndex = 1, AlgorithmType = AlgorithmType.NONE, PrimaryFactorValue = 3 }, new InfluencedFactors { Name = "天数", AlgorithmIndex = 1, AlgorithmType = AlgorithmType.ADD, PrimaryFactorValue = 0, Children = new List <InfluencedFactors> { new InfluencedFactors { Name = "天数", AlgorithmIndex = 1, AlgorithmType = AlgorithmType.NONE, PrimaryFactorValue = 3 }, new InfluencedFactors { Name = "天数", AlgorithmIndex = 1, AlgorithmType = AlgorithmType.DIVIDE, PrimaryFactorValue = 3 } } } } } }; factor1.Children.AddRange(childFactors); AlgorithmType algorithmType = AlgorithmType.NONE; Expression factor = CalculateQuota(factor1, out algorithmType); Console.WriteLine(factor); Func <decimal> factorAction = Expression.Lambda <Func <decimal> >(factor).Compile(); Console.WriteLine(factorAction()); }
internal double LastPayingForAlgo(AlgorithmType algo) { return(_lastLegitPaying[algo]); }
public override void Generate(int nodeCount, NodeHolder nodeHolder, EdgeHolder edgeHolder, AlgorithmType SelectedAlgorithm) { base.Generate(nodeCount, nodeHolder, edgeHolder, SelectedAlgorithm); for (int i = 0; i < nodeCount; i++) { if (i != nodeCount - 1) { var node1 = nodeHolder.GetNodeAt(i); var node2 = nodeHolder.GetNodeAt(i + 1); edgeHolder.AddEgde(new ConsoleEdge(node1, node2)); } else { var node1 = nodeHolder.GetNodeAt(i); var node2 = nodeHolder.GetNodeAt(0); edgeHolder.AddEgde(new ConsoleEdge(node1, node2)); } } }
private static MinerType GetMinerType(DeviceType deviceType, MinerBaseType minerBaseType, AlgorithmType algorithmType) { //if (MinerBaseType.cpuminer == minerBaseType) { // return MinerType.cpuminer_opt; //} if (MinerBaseType.OptiminerAMD == minerBaseType) { return(MinerType.OptiminerZcash); } if (MinerBaseType.sgminer == minerBaseType) { return(MinerType.sgminer); } if (MinerBaseType.ccminer == minerBaseType || MinerBaseType.ccminer_alexis == minerBaseType || MinerBaseType.experimental == minerBaseType) { if (AlgorithmType.CryptoNight == algorithmType) { return(MinerType.ccminer_CryptoNight); } return(MinerType.ccminer); } if (MinerBaseType.Claymore == minerBaseType) { if (AlgorithmType.CryptoNight == algorithmType) { return(MinerType.ClaymoreCryptoNight); } if (AlgorithmType.Equihash == algorithmType) { return(MinerType.ClaymoreZcash); } if (AlgorithmType.DaggerHashimoto == algorithmType) { return(MinerType.ClaymoreDual); } } if (MinerBaseType.Claymore_old == minerBaseType) { if (AlgorithmType.CryptoNight == algorithmType) { return(MinerType.ClaymoreCryptoNight); } } if (MinerBaseType.ethminer == minerBaseType) { if (DeviceType.AMD == deviceType) { return(MinerType.ethminer_OCL); } if (DeviceType.NVIDIA == deviceType) { return(MinerType.ethminer_CUDA); } } if (MinerBaseType.nheqminer == minerBaseType) { if (DeviceType.CPU == deviceType) { return(MinerType.nheqminer_CPU); } if (DeviceType.AMD == deviceType) { return(MinerType.nheqminer_AMD); } if (DeviceType.NVIDIA == deviceType) { return(MinerType.nheqminer_CUDA); } } if (MinerBaseType.eqm == minerBaseType) { if (DeviceType.CPU == deviceType) { return(MinerType.eqm_CPU); } if (DeviceType.NVIDIA == deviceType) { return(MinerType.eqm_CUDA); } } if (MinerBaseType.excavator == minerBaseType) { return(MinerType.excavator); } if (MinerBaseType.EWBF == minerBaseType) { return(MinerType.EWBF); } if (MinerBaseType.Xmrig == minerBaseType) { return(MinerType.Xmrig); } return(MinerType.NONE); }
// NEW START //////////////////////////////////////////// // Pure functions //public static bool IsMinerAlgorithmAvaliable(List<Algorithm> algos, MinerBaseType minerBaseType, AlgorithmType algorithmType) { // return algos.FindIndex((a) => a.MinerBaseType == minerBaseType && a.NiceHashID == algorithmType) > -1; //} public static string GetPathFor(MinerBaseType minerBaseType, AlgorithmType algoType, DeviceGroupType devGroupType, bool def = false) { if (!def & ConfigurableMiners.Contains(minerBaseType)) { // Override with internals var path = MinerPathPackages.Find(p => p.DeviceType == devGroupType) .MinerTypes.Find(p => p.Type == minerBaseType) .Algorithms.Find(p => p.Algorithm == algoType); if (path != null) { if (File.Exists(path.Path)) { return(path.Path); } Helpers.ConsolePrint("PATHS", $"Path {path.Path} not found, using defaults"); } } // Temp workaround if (minerBaseType == MinerBaseType.XmrStak && algoType == AlgorithmType.CryptoNightHeavy) { return(Data.XmrStakHeavy); } switch (minerBaseType) { case MinerBaseType.ccminer: return(NvidiaGroups.Ccminer_path(algoType, devGroupType)); case MinerBaseType.sgminer: return(AmdGroup.SgminerPath(algoType)); case MinerBaseType.nheqminer: return(Data.NhEqMiner); case MinerBaseType.ethminer: return(Data.Ethminer); case MinerBaseType.Claymore: return(AmdGroup.ClaymorePath(algoType)); case MinerBaseType.OptiminerAMD: return(Data.OptiminerZcashMiner); //case MinerBaseType.excavator: // return Data.Excavator; case MinerBaseType.XmrStak: return(Data.XmrStak); case MinerBaseType.ccminer_alexis: return(NvidiaGroups.CcminerUnstablePath(algoType, devGroupType)); case MinerBaseType.experimental: return(Experimental.GetPath(algoType, devGroupType)); case MinerBaseType.EWBF: return(Data.Ewbf); case MinerBaseType.Prospector: return(Data.Prospector); case MinerBaseType.Xmrig: return(Data.Xmrig); case MinerBaseType.dtsm: return(Data.Dtsm); case MinerBaseType.cpuminer: return(Data.CpuMiner); } return(Data.None); }
public MockPredictor(LotteryInfoDto lotteryInfo, AlgorithmType algorithmType) : base(lotteryInfo, algorithmType) { }
private static string CcminerSM21(AlgorithmType algorithmType) { return(AlgorithmType.CryptoNight == algorithmType ? Data.CcminerCryptonight : Data.CcminerDecred); }
public AlgorithmTests(AlgorithmType algorithmType) { AlgorithmType = algorithmType; }
public static string GetPath(AlgorithmType algoType, DeviceGroupType devGroupType) { return(devGroupType == DeviceGroupType.NVIDIA_6_x ? NvidiaGroups.Ccminer_path(algoType, devGroupType) : Data.None); }
private static string ParseForMiningPairs(List<MiningPair> MiningPairs, AlgorithmType algorithmType, DeviceType deviceType, string minerPath, bool showLog = true) { _showLog = showLog; // parse for nheqminer bool deviceCheckSkip = algorithmType == AlgorithmType.Equihash || algorithmType == AlgorithmType.DaggerHashimoto; if (algorithmType == AlgorithmType.Equihash) { // nheqminer if (minerPath == MinerPaths.nheqminer) { if (deviceType == DeviceType.CPU) { CheckAndSetCPUPairs(MiningPairs); return Parse(MiningPairs, _nheqminer_CPU_Options); } if (deviceType == DeviceType.NVIDIA) { return Parse(MiningPairs, _nheqminer_CUDA_Options); } if (deviceType == DeviceType.AMD) { return Parse(MiningPairs, _nheqminer_AMD_Options); } } else if (minerPath == MinerPaths.eqm) { if (deviceType == DeviceType.CPU) { CheckAndSetCPUPairs(MiningPairs); return Parse(MiningPairs, _eqm_CPU_Options); } if (deviceType == DeviceType.NVIDIA) { return Parse(MiningPairs, _eqm_CUDA_Options); } } else if (minerPath == MinerPaths.ClaymoreZcashMiner) { return Parse(MiningPairs, _ClaymoreZcash_Options); } } else if (algorithmType == AlgorithmType.DaggerHashimoto) { // ethminer dagger // use if missing compute device for correct mapping // init fakes workaround var cdevs_mappings = new List<MiningPair>(); { int id = -1; var fakeAlgo = new Algorithm(AlgorithmType.DaggerHashimoto, "daggerhashimoto"); foreach (var pair in MiningPairs) { while (++id != pair.Device.ID) { var fakeCdev = new ComputeDevice(id); cdevs_mappings.Add(new MiningPair(fakeCdev, fakeAlgo)); } cdevs_mappings.Add(pair); } } if (deviceType == DeviceType.NVIDIA) { return Parse(cdevs_mappings, _cudaEthminerOptions); } else if (deviceType == DeviceType.AMD) { return Parse(cdevs_mappings, _oclEthminerOptions); } } else if (deviceCheckSkip == false) { // parse for device if (deviceType == DeviceType.CPU) { CheckAndSetCPUPairs(MiningPairs); return Parse(MiningPairs, _cpuminerOptions); } else if (deviceType == DeviceType.NVIDIA) { if (algorithmType != AlgorithmType.CryptoNight) { return Parse(MiningPairs, _ccimerOptions); } else if (algorithmType == AlgorithmType.CryptoNight) { // check if any device is SM21 or SM3.x if yes return empty for stability reasons foreach (var pair in MiningPairs) { var groupType = pair.Device.DeviceGroupType; if (groupType == DeviceGroupType.NVIDIA_2_1 || groupType == DeviceGroupType.NVIDIA_3_x) { return ""; } } return Parse(MiningPairs, _ccimerCryptoNightOptions, true); } } else if (deviceType == DeviceType.AMD) { // rawIntensity overrides xintensity, xintensity overrides intensity var sgminer_intensities = new List<MinerOption>() { new MinerOption(MinerOptionType.Intensity, "-I", "--intensity", "d", MinerOptionFlagType.MultiParam, ","), // default is "d" check if -1 works new MinerOption(MinerOptionType.Xintensity, "-X", "--xintensity", "-1", MinerOptionFlagType.MultiParam, ","), // default none new MinerOption(MinerOptionType.Rawintensity, "", "--rawintensity", "-1", MinerOptionFlagType.MultiParam, ","), // default none }; var contains_intensity = new Dictionary<MinerOptionType, bool>() { { MinerOptionType.Intensity, false }, { MinerOptionType.Xintensity, false }, { MinerOptionType.Rawintensity, false }, }; // check intensity and xintensity, the latter overrides so change accordingly foreach (var cDev in MiningPairs) { foreach (var intensityOption in sgminer_intensities) { if (!string.IsNullOrEmpty(intensityOption.ShortName) && cDev.CurrentExtraLaunchParameters.Contains(intensityOption.ShortName)) { cDev.CurrentExtraLaunchParameters = cDev.CurrentExtraLaunchParameters.Replace(intensityOption.ShortName, intensityOption.LongName); contains_intensity[intensityOption.Type] = true; } if (cDev.CurrentExtraLaunchParameters.Contains(intensityOption.LongName)) { contains_intensity[intensityOption.Type] = true; } } } // replace if (contains_intensity[MinerOptionType.Intensity] && contains_intensity[MinerOptionType.Xintensity]) { LogParser("Sgminer replacing --intensity with --xintensity"); foreach (var cDev in MiningPairs) { cDev.CurrentExtraLaunchParameters = cDev.CurrentExtraLaunchParameters.Replace("--intensity", "--xintensity"); } } if (contains_intensity[MinerOptionType.Xintensity] && contains_intensity[MinerOptionType.Rawintensity]) { LogParser("Sgminer replacing --xintensity with --rawintensity"); foreach (var cDev in MiningPairs) { cDev.CurrentExtraLaunchParameters = cDev.CurrentExtraLaunchParameters.Replace("--xintensity", "--rawintensity"); } } List<MinerOption> sgminerOptionsNew = new List<MinerOption>(); string temperatureControl = ""; // temp control and parse if (ConfigManager.GeneralConfig.DisableAMDTempControl) { LogParser("DisableAMDTempControl is TRUE, temp control parameters will be ignored"); } else { LogParser("Sgminer parsing temperature control parameters"); temperatureControl = Parse(MiningPairs, _sgminerTemperatureOptions, true, _sgminerOptions); } LogParser("Sgminer parsing default parameters"); string returnStr = String.Format("{0} {1}", Parse(MiningPairs, _sgminerOptions, false, _sgminerTemperatureOptions), temperatureControl); LogParser("Sgminer extra launch parameters merged: " + returnStr); return returnStr; } } return ""; }
extern static bool CryptGenKey( KeyContainerHandle hProv, AlgorithmType algId, KeyFlags dwFlags, [Out]out KeyHandle phKey);