コード例 #1
0
 // Initialize the hash algorithm.
 public override void Initialize()
 {
     if (alg != null)
     {
         alg.Initialize();
     }
     alg = null;
 }
コード例 #2
0
ファイル: sha1managed.cs プロジェクト: 85351/dotnet_framework
        //
        // public methods
        //

        public override void Initialize()
        {
            if (_impl != null)
            {
                _impl.Initialize();
            }
            else
            {
                InitializeState();

                // Zeroize potentially sensitive information.
                Array.Clear(_buffer, 0, _buffer.Length);
                Array.Clear(_expandedBuffer, 0, _expandedBuffer.Length);
            }
        }
コード例 #3
0
        // ********************* Public Methods ************************

        /// <include file='doc\HMACSHA1.uex' path='docs/doc[@for="HMACSHA1.Initialize"]/*' />
        public override void Initialize()
        {
            _hash1.Initialize();
            _hash2.Initialize();
            _bHashing = false;
        }
コード例 #4
0
	public void FIPS186_b (string testName, SHA1 hash, byte[] input, byte[] result) 
	{
		byte[] output = hash.ComputeHash (input, 0, input.Length); 
		Assert.AreEqual (result, output, testName + ".b.1");
		Assert.AreEqual (result, hash.Hash, testName + ".b.2");
		// required or next operation will still return old hash
		hash.Initialize ();
	}
コード例 #5
0
	public void FIPS186_e (string testName, SHA1 hash, byte[] input, byte[] result) 
	{
		byte[] copy = new byte [input.Length];
		for (int i=0; i < input.Length - 1; i++)
			hash.TransformBlock (input, i, 1, copy, i);
		byte[] output = hash.TransformFinalBlock (input, input.Length - 1, 1);
		// LAMESPEC or FIXME: TransformFinalBlock doesn't return HashValue !
		// AssertEquals (testName + ".e.1", result, output);
		Assert.AreEqual (result, hash.Hash, testName + ".e");
		// required or next operation will still return old hash
		hash.Initialize ();
	}
コード例 #6
0
	public void FIPS186_d (string testName, SHA1 hash, byte[] input, byte[] result) 
	{
		byte[] output = hash.TransformFinalBlock (input, 0, input.Length);
		// LAMESPEC or FIXME: TransformFinalBlock doesn't return HashValue !
		// AssertEquals( testName + ".d.1", result, output );
		Assert.AreEqual (result, hash.Hash, testName + ".d");
		// required or next operation will still return old hash
		hash.Initialize ();
	}
コード例 #7
0
	public void FIPS186_c (string testName, SHA1 hash, byte[] input, byte[] result) 
	{
		MemoryStream ms = new MemoryStream (input);
		byte[] output = hash.ComputeHash (ms); 
		Assert.AreEqual (result, output, testName + ".c.1");
		Assert.AreEqual (result, hash.Hash, testName + ".c.2");
		// required or next operation will still return old hash
		hash.Initialize ();
	}
コード例 #8
0
	public void FIPS186_a (string testName, SHA1 hash, byte[] input, byte[] result) 
	{
		byte[] output = hash.ComputeHash (input); 
		AssertEquals (testName + ".a.1", result, output);
		AssertEquals (testName + ".a.2", result, hash.Hash);
		// required or next operation will still return old hash
		hash.Initialize ();
	}