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


C# IDigest类代码示例

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


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

示例1: Encode

		/// <summary>
		/// Encode the stream with the given digest.
		/// </summary>
		/// <param name="data">The byte array to be encoded.</param>
		/// <param name="digest">The digest to be used.</param>
		/// <returns>Hashed value of the byte array as a hex string.</returns>
		private static string Encode(byte[] data, IDigest digest)
		{
			digest.BlockUpdate(data, 0, data.Length);
			byte[] output = new byte[digest.GetDigestSize()];
			digest.DoFinal (output, 0);
			return Hex.Encode(output);
		}
开发者ID:acschmit,项目名称:cryptography.Net,代码行数:13,代码来源:DigestSHA.cs

示例2: PssSigner

 /// <summary>Basic constructor</summary>
 /// <param name="cipher">the asymmetric cipher to use.</param>
 /// <param name="digest">the digest to use.</param>
 /// <param name="salt">the fixed salt to be used.</param>
 public PssSigner(
     IAsymmetricBlockCipher cipher,
     IDigest digest,
     byte[] salt)
     : this(cipher, digest, digest, digest, salt.Length, salt, TrailerImplicit)
 {
 }
开发者ID:KimikoMuffin,项目名称:bc-csharp,代码行数:11,代码来源:PssSigner.cs

示例3: doExpectedTest

		private void doExpectedTest(IDigest digest, int seed, byte[] expected, byte[] noCycle)
		{
			DigestRandomGenerator rGen = new DigestRandomGenerator(digest);
			byte[] output = new byte[digest.GetDigestSize()];

			rGen.AddSeedMaterial(seed);

			for (int i = 0; i != 1024; i++)
			{
				rGen.NextBytes(output);
			}

			if (noCycle != null)
			{
				if (Arrays.AreEqual(noCycle, output))
				{
					Fail("seed not being cycled!");
				}
			}

			if (!Arrays.AreEqual(expected, output))
			{
				Fail("expected output doesn't match");
			}
		}
开发者ID:KimikoMuffin,项目名称:bc-csharp,代码行数:25,代码来源:DigestRandomNumberTest.cs

示例4: GeneratePrivateValue

 public static BigInteger GeneratePrivateValue(IDigest digest, BigInteger N, BigInteger g, SecureRandom random)
 {
     int num = Math.Min(0x100, N.BitLength / 2);
     BigInteger min = BigInteger.One.ShiftLeft(num - 1);
     BigInteger max = N.Subtract(BigInteger.One);
     return BigIntegers.CreateRandomInRange(min, max, random);
 }
开发者ID:Novo,项目名称:apbprivateserver,代码行数:7,代码来源:Srp6Utilities.cs

示例5: CalculateSecret

 /**
  * Processes the client's credentials. If valid the shared secret is generated and returned.
  * @param clientA The client's credentials
  * @return A shared secret BigInteger
  * @throws CryptoException If client's credentials are invalid
  */
 public virtual BigInteger CalculateSecret(IDigest digest, BigInteger clientA)
 {
     this.A = Srp6Utilities.ValidatePublicValue(param.N, clientA);
     this.u = Srp6Utilities.CalculateU(digest, param.N, A, pubB);
     this.S = v.ModPow(u, param.N).Multiply(A).Mod(param.N).ModPow(privB, param.N);
     return S;
 }
开发者ID:GridProtectionAlliance,项目名称:openHistorian,代码行数:13,代码来源:SRP6Server.cs

示例6: DigestRandomGenerator

        public DigestRandomGenerator(
			IDigest digest)
        {
            this.digest = digest;
            this.state = new byte[digest.GetDigestSize()];
            this.counter = 1;
        }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:7,代码来源:DigestRandomGenerator.cs

示例7: HashSP800Drbg

        /**
	     * Construct a SP800-90A Hash DRBG.
	     * <p>
	     * Minimum entropy requirement is the security strength requested.
	     * </p>
	     * @param digest  source digest to use for DRB stream.
	     * @param securityStrength security strength required (in bits)
	     * @param entropySource source of entropy to use for seeding/reseeding.
	     * @param personalizationString personalization string to distinguish this DRBG (may be null).
	     * @param nonce nonce to further distinguish this DRBG (may be null).
	     */
	    public HashSP800Drbg(IDigest digest, int securityStrength, IEntropySource entropySource, byte[] personalizationString, byte[] nonce)
	    {
	        if (securityStrength > DrbgUtilities.GetMaxSecurityStrength(digest))
	            throw new ArgumentException("Requested security strength is not supported by the derivation function");
	        if (entropySource.EntropySize < securityStrength)
	            throw new ArgumentException("Not enough entropy for security strength required");

            mDigest = digest;
	        mEntropySource = entropySource;
	        mSecurityStrength = securityStrength;
            mSeedLength = (int)seedlens[digest.AlgorithmName];

            // 1. seed_material = entropy_input || nonce || personalization_string.
	        // 2. seed = Hash_df (seed_material, seedlen).
	        // 3. V = seed.
	        // 4. C = Hash_df ((0x00 || V), seedlen). Comment: Preceed V with a byte
	        // of zeros.
	        // 5. reseed_counter = 1.
	        // 6. Return V, C, and reseed_counter as the initial_working_state

	        byte[] entropy = GetEntropy();
	        byte[] seedMaterial = Arrays.ConcatenateAll(entropy, nonce, personalizationString);
	        byte[] seed = DrbgUtilities.HashDF(mDigest, seedMaterial, mSeedLength);

            mV = seed;
	        byte[] subV = new byte[mV.Length + 1];
	        Array.Copy(mV, 0, subV, 1, mV.Length);
	        mC = DrbgUtilities.HashDF(mDigest, subV, mSeedLength);

            mReseedCounter = 1;
	    }
开发者ID:KimikoMuffin,项目名称:bc-csharp,代码行数:42,代码来源:HashSP800Drbg.cs

示例8: Iso9796d2Signer

		/// <summary>
		/// Generate a signer for the with either implicit or explicit trailers
		/// for ISO9796-2.
		/// </summary>
		/// <param name="cipher">base cipher to use for signature creation/verification</param>
		/// <param name="digest">digest to use.</param>
		/// <param name="isImplicit">whether or not the trailer is implicit or gives the hash.</param>
		public Iso9796d2Signer(
			IAsymmetricBlockCipher	cipher,
			IDigest					digest,
			bool					isImplicit)
		{
			this.cipher = cipher;
			this.digest = digest;

			if (isImplicit)
			{
				trailer = TrailerImplicit;
			}
			else
			{
				if (digest is Sha1Digest)
				{
					trailer = TrailerSha1;
				}
				else if (digest is RipeMD160Digest)
				{
					trailer = TrailerRipeMD160;
				}
				else if (digest is RipeMD128Digest)
				{
					trailer = TrailerRipeMD128;
				}
				else
				{
					throw new System.ArgumentException("no valid trailer for digest");
				}
			}
		}
开发者ID:nicecai,项目名称:iTextSharp-4.1.6,代码行数:39,代码来源:Iso9796d2Signer.cs

示例9: RsaDigestSigner

		public RsaDigestSigner(
			IDigest digest)
        {
            this.digest = digest;

			algId = new AlgorithmIdentifier( (DerObjectIdentifier)oidMap[digest.AlgorithmName] , DerNull.Instance);
        }
开发者ID:nicecai,项目名称:iTextSharp-4.1.6,代码行数:7,代码来源:RsaDigestSigner.cs

示例10: DsaDigestSigner

		public DsaDigestSigner(
			IDsa	signer,
			IDigest	digest)
        {
            this.digest = digest;
            this.dsaSigner = signer;
        }
开发者ID:htlp,项目名称:itextsharp,代码行数:7,代码来源:DsaDigestSigner.cs

示例11: DeferredHash

 private DeferredHash(byte prfHashAlgorithm, IDigest prfHash)
 {
     this.mBuf = null;
     this.mHashes = Platform.CreateHashtable();
     this.mPrfHashAlgorithm = prfHashAlgorithm;
     mHashes[prfHashAlgorithm] = prfHash;
 }
开发者ID:JohnMalmsteen,项目名称:mobile-apps-tower-defense,代码行数:7,代码来源:DeferredHash.cs

示例12: NonMemoableDigest

        /**
         * Base constructor.
         *
         * @param baseDigest underlying digest to use.
         * @exception IllegalArgumentException if baseDigest is null
         */
        public NonMemoableDigest(IDigest baseDigest)
        {
            if (baseDigest == null)
                throw new ArgumentNullException("baseDigest");

            this.mBaseDigest = baseDigest;
        }
开发者ID:KimikoMuffin,项目名称:bc-csharp,代码行数:13,代码来源:NonMemoableDigest.cs

示例13: GenericSigner

        public GenericSigner(
			IAsymmetricBlockCipher	engine,
			IDigest					digest)
        {
            this.engine = engine;
            this.digest = digest;
        }
开发者ID:Noyabronok,项目名称:itextsharpml,代码行数:7,代码来源:GenericSigner.cs

示例14: OaepEncoding

 public OaepEncoding(
     IAsymmetricBlockCipher	cipher,
     IDigest					hash,
     byte[]					encodingParams)
     : this(cipher, hash, hash, encodingParams)
 {
 }
开发者ID:MBrekhof,项目名称:pleiobox-clients,代码行数:7,代码来源:OaepEncoding.cs

示例15: Init

	    /**
	     * Initialises the client to begin new authentication attempt
	     * @param N The safe prime associated with the client's verifier
	     * @param g The group parameter associated with the client's verifier
	     * @param digest The digest algorithm associated with the client's verifier
	     * @param random For key generation
	     */
	    public virtual void Init(BigInteger N, BigInteger g, IDigest digest, SecureRandom random)
	    {
	        this.N = N;
	        this.g = g;
	        this.digest = digest;
	        this.random = random;
	    }
开发者ID:htlp,项目名称:itextsharp,代码行数:14,代码来源:SRP6Client.cs


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