Beispiel #1
0
        static private void Bug_004_32()
        {
            Stream stream = File.OpenRead(CURRENT_PATH + @"\Resources\bug004.txt");

            XXHash.State32 state = XXHash.CreateState32();
            XXHash.UpdateState32(state, new byte[] { 0x01 });
            XXHash.UpdateState32(state, stream);

            uint result = XXHash.DigestState32(state);          // compute the XXH32 hash value.

            Console.WriteLine(result.ToString("x8"));
        }
Beispiel #2
0
        static private void DemoXXHash32()
        {
            Stream stream = File.OpenRead(CURRENT_PATH + @"\Resources\letters.txt"); // the data to be hashed

            XXHash.State32 state = XXHash.CreateState32();                           // create and initialize a xxH states instance.
            // NOTE:
            //   xxHash require a xxH state object for keeping
            //   data, seed, and vectors.

            XXHash.UpdateState32(state, stream);                // puts the file stream into specified xxH state.

            uint result = XXHash.DigestState32(state);          // compute the XXH32 hash value.

            Console.WriteLine(result.ToString("x4"));
        }
Beispiel #3
0
        //called when data for any output pin is requested
        public void Evaluate(int SpreadMax)
        {
            if (!FInput.IsChanged)
            {
                return;
            }

            FOutput.SliceCount = SpreadMax;

            for (int i = 0; i < SpreadMax; i++)
            {
                var inbytes = Encoding.Default.GetBytes(FInput[i]);
                XXHash.ResetState32(_xxHashState, 51423);
                XXHash.UpdateState32(_xxHashState, inbytes, 0, inbytes.Length);
                FOutput[i] = XXHash.DigestState32(_xxHashState);
            }
        }