Ejemplo n.º 1
0
        void issue_14_it_should_decode_encode_hex_correctly()
        {
            var hashids = new Hashids("this is my salt");
            var encoded = hashids.EncodeHex("DEADBEEF");
            encoded.Should().Be("kRNrpKlJ");

            var decoded = hashids.DecodeHex(encoded);
            decoded.Should().Be("DEADBEEF");

            var encoded2 = hashids.EncodeHex("1234567890ABCDEF");
            var decoded2 = hashids.DecodeHex(encoded2);
            decoded2.Should().Be("1234567890ABCDEF");
        }
Ejemplo n.º 2
0
        void issue_14_it_should_decode_encode_hex_correctly()
        {
            var hashids = new Hashids("this is my salt");
            var encoded = hashids.EncodeHex("DEADBEEF");

            encoded.Should().Be("kRNrpKlJ");

            var decoded = hashids.DecodeHex(encoded);

            decoded.Should().Be("DEADBEEF");

            var encoded2 = hashids.EncodeHex("1234567890ABCDEF");
            var decoded2 = hashids.DecodeHex(encoded2);

            decoded2.Should().Be("1234567890ABCDEF");
        }
Ejemplo n.º 3
0
        public void HexString_Roundtrip()
        {
            var hashids = new Hashids("this is my salt");

            var encoded = hashids.EncodeHex("DEADBEEF");

            encoded.Should().Be("kRNrpKlJ");

            var decoded = hashids.DecodeHex(encoded);

            decoded.Should().Be("DEADBEEF");

            var input2   = "1234567890ABCDEF";
            var decoded2 = hashids.DecodeHex(hashids.EncodeHex(input2));

            decoded2.Should().Be(input2);
        }
        public string DecodeValueToString(string id)
        {
            ValidateInput(id);
            var hexValue = _hashIds.DecodeHex(id);
            var actualId = FromHexToString(hexValue);

            return(actualId);
        }
Ejemplo n.º 5
0
 public void HexString_Decode()
 {
     _hashids.DecodeHex("lzY").Should().Be("FA");
     _hashids.DecodeHex("eBMrb").Should().Be("FF1A");
     _hashids.DecodeHex("D9NPE").Should().Be("12ABC");
 }
Ejemplo n.º 6
0
 void it_decode_an_encoded_number()
 {
     hashids.DecodeHex("lzY").Should().Be("FA");
     hashids.DecodeHex("eBMrb").Should().Be("FF1A");
     hashids.DecodeHex("D9NPE").Should().Be("12ABC");
 }
        public string DecodeUserEmail(string encodedUrl)
        {
            var decodedHex = _hashedId.DecodeHex(encodedUrl);

            return(Encoding.ASCII.GetString(FromHex(decodedHex)));
        }
Ejemplo n.º 8
0
 private void It_decode_an_encoded_number()
 {
     _hashids.DecodeHex("lzY").ShouldBe("FA");
     _hashids.DecodeHex("eBMrb").ShouldBe("FF1A");
     _hashids.DecodeHex("D9NPE").ShouldBe("12ABC");
 }