Beispiel #1
0
        public void it_encrypts_longs_identical_to_the_nodejs_lib()
        {
            var resultsFromNodeLib = new Dictionary <string, long>()
            {
                { "y2jl7rm5", 1234567890 },
                { "q2dxzp4vq", 9876543210 },
                { "77m", 123 },
                { "43l3w7", 789456 }
            };

            foreach (var kvp in resultsFromNodeLib)
            {
                Assert.AreEqual(kvp.Key, hashids.Encrypt(kvp.Value));
            }
        }
Beispiel #2
0
        void it_can_encrypt_to_a_minimum_length()
        {
            var h = new Hashids(salt, 8);

            h.Encrypt(1).Should().Be("b9iLXiAa");
        }
Beispiel #3
0
 void it_encrypts_a_single_number()
 {
     hashids.Encrypt(12345).Should().Be("ryBo");
     hashids.Encrypt(1).Should().Be("LX");
     hashids.Encrypt(22).Should().Be("5B");
     hashids.Encrypt(333).Should().Be("o49");
     hashids.Encrypt(9999).Should().Be("GKnB");
 }
Beispiel #4
0
        void it_can_encrypt_with_a_swapped_custom()
        {
            var hashids = new Hashids("this is my salt", 0, "abcd");

            hashids.Encrypt(1, 2, 3, 4, 5).Should().Be("adcdacddcdaacdad");
        }
		void it_can_encrypt_to_a_minimum_length()
		{
			var h = new Hashids(salt, 8);
			h.Encrypt(1).Should().Be("b9iLXiAa");
		}
		void it_can_encrypt_with_a_swapped_custom()
		{
			var hashids = new Hashids("this is my salt", 0, "abcd");
			hashids.Encrypt(1, 2, 3, 4, 5).Should().Be("adcdacddcdaacdad");
		}