Changeset 38 for trunk/CrypPlugins/PKCS5


Ignore:
Timestamp:
Nov 20, 2008, 5:32:42 PM (13 years ago)
Author:
Gerhard Junker
Message:

PKCS5 test methods completed (some external references missing)

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore set to
      *.suo
  • trunk/CrypPlugins/PKCS5/SSCpkcs5.cs

    r30 r38  
    2323namespace System.Security.Cryptography
    2424{
    25 
     25    /// <summary>
     26    /// insert PKSC #5 v2 into default namespace
     27    /// </summary>
    2628    [ComVisibleAttribute(true)]
    2729    public class PKCS5MaskGenerationMethod : System.Security.Cryptography.MaskGenerationMethod
     
    6365        /// <param name="shaf">The shaf.</param>
    6466        /// <returns></returns>
    65         public int GetHashLength()
    66         {
    67             switch (selectedShaFunction)
     67        private int GetHashLength()
     68        {
     69            switch (this.SelectedShaFunction)
    6870            {
    6971                case ShaFunction.MD5:
     
    122124                    throw new ArgumentOutOfRangeException("SelectedShaFunction");
    123125            }
    124 
     126         
    125127            ha.Key = key;
    126128            byte[] h = ha.ComputeHash(salt);
     
    230232            int blockCount = cbReturn / hLen + 1;
    231233            int fillBytes = cbReturn - (blockCount - 1) * hLen;
    232             //if (fillBytes == 0)
    233             //  blockCount--;
    234 
    235 #if DEBUG
    236             {
    237                 string msg = string.Format("Generate {0} blocks with {1} bytes.", blockCount, hLen);
    238                 Debug.WriteLine(msg);
    239                 msg = string.Format("The last block has {0} bytes.", fillBytes);
    240                 Debug.WriteLine(msg);
    241                 msg = string.Format("requested bytes {0} - generating {1} bytes.", cbReturn, (blockCount - 1) * hLen + fillBytes);
    242                 Debug.WriteLine(msg);
    243             }
    244 #endif
     234
     235//#if DEBUG
     236//            {
     237//                string msg = string.Format("Generate {0} blocks with {1} bytes.", blockCount, hLen);
     238//                Debug.WriteLine(msg);
     239//                msg = string.Format("The last block has {0} bytes.", fillBytes);
     240//                Debug.WriteLine(msg);
     241//                msg = string.Format("requested bytes {0} - generating {1} bytes.", cbReturn, (blockCount - 1) * hLen + fillBytes);
     242//                Debug.WriteLine(msg);
     243//            }
     244//#endif
    245245
    246246            if (blockCount > 255)
     
    254254            for (int blockIndex = 0; blockIndex < blockCount - 1; blockIndex++)
    255255            {
    256                 byte[] block = GenKeyBlock(password, rgbSalt, count, blockIndex);
     256                byte[] block = GenKeyBlock(password, rgbSalt, count, blockIndex+1);
    257257                for (int i = 0; i < hLen; i++)
    258258                    key[outPos++] = block[i];
Note: See TracChangeset for help on using the changeset viewer.