コード例 #1
0
        public void Test()
        {
            var trits = Converter.GetTrits(input);
            var kerl  = new Kerl();

            kerl.Initialize();
            kerl.Absorb(trits, 0, trits.Length);
            var hashTrits = new sbyte[Curl.HASH_LENGTH];

            kerl.Squeeze(hashTrits, 0, Curl.HASH_LENGTH);
            var hash = Converter.GetTrytes(hashTrits);

            Assert.AreEqual(expected, hash);
            //assert.deepEqual(test.expected, hash);
        }
コード例 #2
0
        public void KerlMultiAbsorbMultiSqueeze()
        {
            var input    = "G9JYBOMPUXHYHKSNRNMMSSZCSHOFYOYNZRSZMAAYWDYEIMVVOGKPJBVBM9TDPULSFUNMTVXRKFIDOHUXXVYDLFSZYZTWQYTE9SPYYWYTXJYQ9IFGYOLZXWZBKWZN9QOOTBQMWMUBLEWUEEASRHRTNIQWJQNDWRYLCA";
            var expected = "LUCKQVACOGBFYSPPVSSOXJEKNSQQRQKPZC9NXFSMQNRQCGGUL9OHVVKBDSKEQEBKXRNUJSRXYVHJTXBPDWQGNSCDCBAIRHAQCOWZEBSNHIJIGPZQITIBJQ9LNTDIBTCQ9EUWKHFLGFUVGGUWJONK9GBCDUIMAYMMQX";

            var trits = Converter.GetTrits(input);
            var kerl  = new Kerl();

            kerl.Initialize();
            kerl.Absorb(trits, 0, trits.Length);
            var hashTrits = new sbyte[Kerl.HASH_LENGTH * 2];

            kerl.Squeeze(hashTrits, 0, Kerl.HASH_LENGTH * 2);
            var hash = Converter.GetTrytes(hashTrits);

            Assert.AreEqual(expected, hash);
        }
コード例 #3
0
        public void KerlAbsorbSqueeze()
        {
            var input    = "GYOMKVTSNHVJNCNFBBAH9AAMXLPLLLROQY99QN9DLSJUHDPBLCFFAIQXZA9BKMBJCYSFHFPXAHDWZFEIZ";
            var expected = "OXJCNFHUNAHWDLKKPELTBFUCVW9KLXKOGWERKTJXQMXTKFKNWNNXYD9DMJJABSEIONOSJTTEVKVDQEWTW";

            var trits = Converter.GetTrits(input);
            var kerl  = new Kerl();

            kerl.Initialize();
            kerl.Absorb(trits, 0, trits.Length);
            var hashTrits = new sbyte[Kerl.HASH_LENGTH];

            kerl.Squeeze(hashTrits, 0, Kerl.HASH_LENGTH);
            var hash = Converter.GetTrytes(hashTrits);

            Assert.AreEqual(expected, hash);
        }
コード例 #4
0
        public void KerlAbsorbMultiSqueeze()
        {
            var input    = "9MIDYNHBWMBCXVDEFOFWINXTERALUKYYPPHKP9JJFGJEIUY9MUDVNFZHMMWZUYUSWAIOWEVTHNWMHANBH";
            var expected = "G9JYBOMPUXHYHKSNRNMMSSZCSHOFYOYNZRSZMAAYWDYEIMVVOGKPJBVBM9TDPULSFUNMTVXRKFIDOHUXXVYDLFSZYZTWQYTE9SPYYWYTXJYQ9IFGYOLZXWZBKWZN9QOOTBQMWMUBLEWUEEASRHRTNIQWJQNDWRYLCA";

            var trits = Converter.GetTrits(input);
            var kerl  = new Kerl();

            kerl.Initialize();
            kerl.Absorb(trits, 0, trits.Length);
            var hashTrits = new sbyte[Kerl.HASH_LENGTH * 2];

            kerl.Squeeze(hashTrits, 0, Kerl.HASH_LENGTH * 2);
            var hash = Converter.GetTrytes(hashTrits);

            Assert.AreEqual(expected, hash);
        }