Beispiel #1
0
        public void OverflowFirstInt32()
        {
            var cc = new CypherCounter(16, "ffffffff000000000000000000000000".ParseFromHexString());

            cc.Increment();
            Assert.AreEqual("00000000010000000000000000000000", cc.GetCounter().ToHexString());
        }
Beispiel #2
0
        public void OverflowSecondInt64()
        {
            var cc = new CypherCounter(16, "ffffffffffffffffffffffffffffffff".ParseFromHexString());

            cc.Increment();
            Assert.AreEqual("00000000000000000000000000000000", cc.GetCounter().ToHexString());
        }
Beispiel #3
0
        public void IncrementOnce()
        {
            var cc = new CypherCounter(16);

            cc.Increment();
            Assert.AreEqual("01000000000000000000000000000000", cc.GetCounter().ToHexString());
        }
Beispiel #4
0
        public void Overflow8ByteChunk1()
        {
            var cc = new CypherCounter(8, "ffffffffffffffff".ParseFromHexString());

            cc.Increment();
            Assert.AreEqual("0000000000000000", cc.GetCounter().ToHexString());
        }
Beispiel #5
0
        public void Default32ByteCounterIsZero()
        {
            var cc = new CypherCounter(32);

            Assert.AreEqual("0000000000000000000000000000000000000000000000000000000000000000", cc.GetCounter().ToHexString());
        }
Beispiel #6
0
        public void IncrementInitialiseFromArray()
        {
            var cc = new CypherCounter(16, "02000000000000000000000000000000".ParseFromHexString());

            Assert.AreEqual("02000000000000000000000000000000", cc.GetCounter().ToHexString());
        }
Beispiel #7
0
        public void EightByteCounterSupported()
        {
            var cc = new CypherCounter(8);

            Assert.AreEqual("0000000000000000", cc.GetCounter().ToHexString());
        }
Beispiel #8
0
 public Task <byte[]> GetEntropyAsync(EntropyPriority priority)
 {
     // Increment the counter and return its value.
     _Counter.Increment();
     return(Task.FromResult(_Counter.GetCounter()));
 }