예제 #1
0
    static void Main()
    {
        Kiwi.Pause();
        PearsonHash.Seed((byte)(10));
        Kiwi.Pause();

        // FIXME these loops seem to give rise to infinite behaviour by Kiwi.
        //       Perhaps related to use of "byte"?

        /*
         * for (byte i = 0; i <= 255; i++) {
         * PearsonHash.SetTable(i, (byte)(255 - i));
         * Kiwi.Pause();
         * }
         */
        for (int i = 0; i < 256; i++)
        {
            PearsonHash.SetTable((byte)i, (byte)(255 - i));
            Kiwi.Pause();
        }

        PearsonHash.SetTable(10, 20);
        PearsonHash.SetTable(20, 10);

        PearsonHash.StreamHash(0);
        PearsonHash.StreamHash(1);
        PearsonHash.StreamHash(2);
        PearsonHash.StreamHash(3);

        PearsonHash.Seed((byte)(8));

        // FIXME these loops seem to give rise to infinite behaviour by Kiwi.
        //       Perhaps related to use of "byte"?

        /*
         * for (byte i = 0; i <= 255; i++) {
         * PearsonHash.StreamHash(i);
         * Kiwi.Pause();
         * }
         */
        for (int i = 0; i < 256; i++)
        {
            PearsonHash.StreamHash((byte)i);
            Kiwi.Pause();
        }

        PearsonHash.BlockHash(901242);
        PearsonHash.BlockHash(10);
        PearsonHash.BlockHash(901242);
        PearsonHash.BlockHash(10);
    }
예제 #2
0
 public int GetHash()
 {
     return(PearsonHash.Compute(new[] { _salt, _c1, _c2, _c3 }));
 }