示例#1
0
        /******************************************************************************/
        /*********************METHODS**************************/

        /// <summary>
        /// calculat md5 signature of the string in Input
        /// </summary>
        /// <returns> Digest: the finger print of msg</returns>
        protected __Digest CalculateMD5Value()
        {
            /***********vairable declaration**************/
            byte[]   bMsg;                //buffer to hold bits
            uint     N;                   //N is the size of msg as  word (32 bit)
            __Digest dg = new __Digest(); //  the value to be returned

            // jsc can handle local byrefs for now
            var dg_A = dg.A;
            var dg_B = dg.B;
            var dg_C = dg.C;
            var dg_D = dg.D;

            // create a buffer with bits padded and length is alos padded
            bMsg = CreatePaddedBuffer();

            N = (uint)(bMsg.Length * 8) / 32;           //no of 32 bit blocks

            for (uint i = 0; i < N / 16; i++)
            {
                CopyBlock(bMsg, i);
                PerformTransformation(ref dg_A, ref dg_B, ref dg_C, ref dg_D);
                //PerformTransformation(ref dg.A, ref dg.B, ref dg.C, ref dg.D);
            }

            // jsc can handle local byrefs for now
            dg.A = dg_A;
            dg.B = dg_B;
            dg.C = dg_C;
            dg.D = dg_D;
            return(dg);
        }
        /******************************************************************************/
        /*********************METHODS**************************/

        /// <summary>
        /// calculat md5 signature of the string in Input
        /// </summary>
        /// <returns> Digest: the finger print of msg</returns>
        protected __Digest CalculateMD5Value()
        {
            /***********vairable declaration**************/
            byte[] bMsg;	//buffer to hold bits
            uint N;			//N is the size of msg as  word (32 bit) 
            __Digest dg = new __Digest();			//  the value to be returned

            // jsc can handle local byrefs for now
            var dg_A = dg.A;
            var dg_B = dg.B;
            var dg_C = dg.C;
            var dg_D = dg.D;

            // create a buffer with bits padded and length is alos padded
            bMsg = CreatePaddedBuffer();

            N = (uint)(bMsg.Length * 8) / 32;		//no of 32 bit blocks

            for (uint i = 0; i < N / 16; i++)
            {
                CopyBlock(bMsg, i);
                PerformTransformation(ref dg_A, ref dg_B, ref dg_C, ref dg_D);
                //PerformTransformation(ref dg.A, ref dg.B, ref dg.C, ref dg.D);
            }

            // jsc can handle local byrefs for now
            dg.A = dg_A;
            dg.B = dg_B;
            dg.C = dg_C;
            dg.D = dg_D;
            return dg;
        }