当前位置: 首页>>代码示例>>C#>>正文


C# Algorithm类代码示例

本文整理汇总了C#中Algorithm的典型用法代码示例。如果您正苦于以下问题:C# Algorithm类的具体用法?C# Algorithm怎么用?C# Algorithm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Algorithm类属于命名空间,在下文中一共展示了Algorithm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetBenchmarkCommandStringPart

 protected override string GetBenchmarkCommandStringPart(ComputeDevice benchmarkDevice, Algorithm algorithm)
 {
     return " --opencl --opencl-platform " + GPUPlatformNumber
         + " " + algorithm.ExtraLaunchParameters
         + " --benchmark-warmup 40 --benchmark-trial 20"
         + " --opencl-devices ";
 }
开发者ID:CharlesDeep,项目名称:NiceHashMiner,代码行数:7,代码来源:MinerEtherumOCL.cs

示例2: EncryptedAttribute

 public EncryptedAttribute( string key, string salt, Algorithm algorithm = Crypt.Algorithm.Rijndael )
 {
     var db = new Rfc2898DeriveBytes( key, Encoding.ASCII.GetBytes( salt ), 2 );
     this.Algorithm = algorithm;
     this.Key = db.GetBytes( KeySize( this.Algorithm ) / 8 );
     this.Vector = db.GetBytes( 16 );
 }
开发者ID:ikariiwarrior,项目名称:Alpaca,代码行数:7,代码来源:EncryptedAttribute.cs

示例3: Signature

 /// <summary>
 /// Main constructor.
 /// </summary>
 /// <param name="KeyID">
 /// A <see cref="System.String"/>, the primary key ID.
 /// </param>
 /// <param name="SignKey">
 /// A <see cref="System.String"/>, the signing key ID.
 /// </param>
 /// <param name="SignDate">
 /// A <see cref="System.String"/>, the signature date (seconds from Epoch)
 /// </param>
 public Signature(string KeyID, string SignKey, string SignDate)
 {
     // sig:::17:F4B4B0CC797EBFAB:1223678701::::Enrico Zini <[email protected]>:10x:
     //			Console.WriteLine(String.Format("Key: {0} - SignKey: {1} - SignDate: {2}", KeyID, Key, Date));
     GPG gpg = new GPG(KeyID, Commands.List);
     gpg.Exec();
     foreach (string line in gpg.Output.Split('\n')) {
         RecordType tag = Utils.GetRecordType(Utils.GetField(line, 0));
         if (tag == RecordType.Signature) {
             string key = Utils.GetField(line, 4);
             string date = Utils.GetField(line, 5);
             if ((key == SignKey) && (date == SignDate)) {
                 this._algorithm = Utils.GetAlgorithm(Convert.ToInt32(Utils.GetField(line, 3)));
                 this._user = Utils.ParseUsername(Utils.GetField(line, 9));
                 this._signingKey = SignKey;
                 this._signingDate = SignDate;
                 // TODO: also parse the "10x" above? The docs give very poor info:
                 /*
                  * 11. Field:  Signature class.  This is a 2 digit hexnumber followed by
                  *             either the letter 'x' for an exportable signature or the
                  *             letter 'l' for a local-only signature.
                  *             The class byte of an revocation key is also given here,
                  *             'x' and 'l' ist used the same way.
                  */
             }
         }
     }
 }
开发者ID:veshu,项目名称:gnupg-sharp,代码行数:40,代码来源:Signature.cs

示例4: Generator

        public Generator(string data)
        {
			byte[] d = Convert.FromBase64String(data);
			string strXML = Encoding.UTF8.GetString(d);
			XmlDocument doc = new System.Xml.XmlDocument();
			doc.LoadXml(strXML);

			XmlNode root = doc.SelectSingleNode("/vmp-lm-product");
			if (root == null) throw new ArgumentException("Invalid data: not a product information string");

			XmlNode attrProduct = root.SelectSingleNode("@product");
			if (attrProduct == null) throw new ArgumentException("Invalid data: information about product is missed");
			pProductCode = Convert.FromBase64String(attrProduct.Value);
			if (pProductCode.Length != 8) throw new ArgumentException("Invalid data: product code has incorrect length");

			XmlNode nodeAlgo = root.SelectSingleNode("@algorithm");
			if (nodeAlgo == null) throw new ArgumentException("Invalid data: missed encryption algorithm");
			switch (nodeAlgo.Value)
			{
				case "RSA":
					algo = new AlgorithmRSA(root);
					break;
				default:
					throw new ArgumentException("Invalid data: unsupported encryption algorithm");
			}
        }
开发者ID:yuang1516,项目名称:WebbrowserLock,代码行数:26,代码来源:Generator.cs

示例5: Main

        static void Main(string[] args)
        {
            var line = Console.ReadLine();
            var segments = line.Split(' ');

            var Rows = Convert.ToInt32(segments[0]);
            var Columns = Convert.ToInt32(segments[1]);
            var rotations = Convert.ToInt32(segments[2]);

            var matrix = new int[Rows][];
            for (int i = 0; i < Rows; i++)
            {
                line = Console.ReadLine();
                segments = line.Split(' ');
                matrix[i] = new int[segments.Length];

                for (int t = 0; t < segments.Length; t++)
                {
                    matrix[i][t] = Convert.ToInt32(segments[t]);
                }
            }

            var algorithm = new Algorithm();

            algorithm.Process(matrix, rotations);
        }
开发者ID:lgeeraerts,项目名称:HackerRankSandbox,代码行数:26,代码来源:Program.cs

示例6: MiningAlgorithm

 public MiningAlgorithm(ComputeDevice dev, Algorithm algo)
 {
     this.AlgoRef = algo;
     // init speed that will be avaraged later
     this.AvaragedSpeed = algo.BenchmarkSpeed;
     this.MinerPath = MinerPaths.GetOptimizedMinerPath(dev, algo);
 }
开发者ID:nicehash,项目名称:NiceHashMiner,代码行数:7,代码来源:MiningAlgorithm.cs

示例7: ShowResults

        public static void ShowResults(Algorithm.MMatrixAlgorithm algorithm)
        {
            ResultsForm form = new ResultsForm();
            form.m_Algorithm = algorithm;

            form.ShowDialog();
        }
开发者ID:pavkam,项目名称:school,代码行数:7,代码来源:ResultsForm.cs

示例8: Main

    public void Main()
    {
        var m = new Algorithm();

        m.TemplateMethod(new ClassA());
        m.TemplateMethod(new ClassB());
    }
开发者ID:david--liu,项目名称:code_kata,代码行数:7,代码来源:TemplateMethodPattern.cs

示例9: Start

        public override void Start(Algorithm miningAlgorithm, string url, string username)
        {
            CurrentMiningAlgorithm = miningAlgorithm;
            if (miningAlgorithm == null) return;

            string algo = "";
            string apiBind = "";
            string intensity = "";
            if (CurrentMiningAlgorithm.NiceHashID != AlgorithmType.CryptoNight) {
                algo = "--algo=" + miningAlgorithm.MinerName;
                apiBind = " --api-bind=" + APIPort.ToString();
                intensity = getIntensityString();
            }

            IsAPIReadException = CurrentMiningAlgorithm.NiceHashID == AlgorithmType.CryptoNight;

            LastCommandLine = algo +
                                  " --url=" + url +
                                  " --userpass=" + username + ":" + Algorithm.PasswordDefault +
                                  apiBind +
                                  " " + miningAlgorithm.ExtraLaunchParameters +
                                  intensity +
                                  " --devices ";

            LastCommandLine += GetDevicesCommandString();

            Path = GetOptimizedMinerPath(miningAlgorithm.NiceHashID);

            ProcessHandle = _Start();
        }
开发者ID:CharlesDeep,项目名称:NiceHashMiner,代码行数:30,代码来源:ccminer.cs

示例10: CreateNew

 /// <summary>
 /// Creates a new private key.
 /// </summary>
 /// <param name="keyProvider">The provider for the key. <see cref="KeyProviders"/> contains different types of providers.</param>
 /// <param name="keyName">The name of the key to persist. Use <c>null</c> to create an ephemeral key.</param>
 /// <param name="algorithm">The algorithm of the key. Not all providers support all algorithms.</param>
 /// <param name="keyUsage">Specifies the purpose of the key. This is not appicable to CNG algorithms.</param>
 /// <param name="keySize">The size of the key. Only valid for RSA keys.</param>
 /// <param name="overwrite">True to overwrite the provider's exisint private key, otherwise false.</param>
 /// <returns>A new private key.</returns>
 public static PrivateKey CreateNew(KeyProviderBase keyProvider, string keyName, Algorithm algorithm, KeyUsage keyUsage, int? keySize = null, bool overwrite = false)
 {
     var keySizeValue = keySize ?? 2048;
     KeySpec keySpec;
     var handle = keyProvider.CreateKey(keyName, keySizeValue, algorithm, overwrite, keyUsage, out keySpec);
     return new PrivateKey(handle, keyProvider, keySpec);
 }
开发者ID:blinds52,项目名称:FiddlerCertGen,代码行数:17,代码来源:PrivateKey.cs

示例11: GetHashFile

        public void GetHashFile(Algorithm algorithm, bool useNullFile)
        {
            FileInfo file = null;

            if (!useNullFile)
            {
                string tempFile = Path.GetTempFileName();

                using (var sw = new StreamWriter(tempFile, false))
                {
                    for (int i = 0; i < 100; i++)
                    {
                        sw.Write(GenerateText(10, 500));
                        sw.Write(" ");
                    }
                }

                file = new FileInfo(tempFile);
            }

            string hashed = DataHashing.Compute(algorithm, file);

            Assert.IsTrue(DataHashing.Validate(algorithm, file, hashed));

            if (!useNullFile)
            {
                file.Delete();
            }
        }
开发者ID:eagleboost,项目名称:EfficientlyLazy.Crypto,代码行数:29,代码来源:DataHashingTests.cs

示例12: SetCurrentlySelected

        public void SetCurrentlySelected(ListViewItem lvi, ComputeDevice computeDevice)
        {
            // should not happen ever
            if (lvi == null) return;

            _computeDevice = computeDevice;
            var algorithm = lvi.Tag as Algorithm;
            if (algorithm != null) {
                _selected = true;
                _currentlySelectedAlgorithm = algorithm;
                _currentlySelectedLvi = lvi;
                this.Enabled = lvi.Checked;

                groupBoxSelectedAlgorithmSettings.Text = String.Format(International.GetText("AlgorithmsListView_GroupBox"),
                algorithm.GetName()); ;

                field_LessThreads.Enabled = _computeDevice.DeviceGroupType == DeviceGroupType.CPU;
                if (field_LessThreads.Enabled) {
                    field_LessThreads.EntryText = algorithm.LessThreads.ToString();
                }
                fieldBoxBenchmarkSpeed.EntryText = ParseDoubleDefault(algorithm.BenchmarkSpeed);
                richTextBoxExtraLaunchParameters.Text = ParseStringDefault(algorithm.ExtraLaunchParameters);
                this.Update();
            } else {
                // TODO this should not be null
            }
        }
开发者ID:nicehash,项目名称:NiceHashMiner,代码行数:27,代码来源:AlgorithmSettingsControl.cs

示例13: SolutionStepCompletedEventArgs

 public SolutionStepCompletedEventArgs(string step, bool finished, Algorithm moves, int milliseconds, SolutionStepType type = SolutionStepType.Standard)
 {
     this.Step = step;
     this.Finished = finished;
     this.Algorithm = moves;
     this.Milliseconds = milliseconds;
     this.Type = type;
 }
开发者ID:GertClaeskens,项目名称:RubiksCubeSolver_Bewerkt,代码行数:8,代码来源:SolutionStepCompleted.cs

示例14: Copy

 public void Copy(Work work)
 {
     hashStart = work.hashStart;
     hashCount = work.hashCount;
     hashAlgorithm = work.hashAlgorithm;
     Array.Copy(work.target, target, 8);
     Array.Copy(work.data, data, 32);
 }
开发者ID:GarageGames,项目名称:Bitcoin,代码行数:8,代码来源:Work.cs

示例15: CreateMiner

 // create miner creates new miners based on device type and algorithm/miner path
 public static Miner CreateMiner(ComputeDevice device, Algorithm algorithm)
 {
     var minerPath = MinerPaths.GetOptimizedMinerPath(device, algorithm);
     if (minerPath != MinerPaths.NONE) {
         return CreateMiner(device.DeviceType, minerPath);
     }
     return null;
 }
开发者ID:nicehash,项目名称:NiceHashMiner,代码行数:9,代码来源:MinersManager.cs


注:本文中的Algorithm类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。