public void TestStringKey() { using (var anonymiser = new Anonymiser("n1dn5emfcakghfo13nbsjfdk3mbuk83h")) { var input = IPAddress.Parse("129.69.205.36"); var actual = anonymiser.Anonymise(input); var expected = IPAddress.Parse("97.2.50.215"); Assert.AreEqual(expected, actual); } }
public async Task Anonymise(long id) { var user = await Unit.Users.Get(id); if (user.PhotoId.HasValue) { await Files.Remove(user.PhotoId.Value); } user = Anonymiser.Anonymise(user); await Unit.Complete(); }
public void TestIPAddress6() { using (var anonymiser = new Anonymiser(Key)) { foreach (var t in IPv6) { var input = IPAddress.Parse(t.Key); var actual = anonymiser.Anonymise(input); var expected = IPAddress.Parse(t.Value); Assert.AreEqual(expected, actual); } } }
public void TestBytes64() { using (var anonymiser = new Anonymiser(Key)) { foreach (var t in IPv4) { var input = IPAddress.Parse(t.Key).GetAddressBytes(); var output = anonymiser.Anonymise(input); var actual = new IPAddress(output); var expected = IPAddress.Parse(t.Value); Assert.AreEqual(expected, actual); } } }
public void TestDeanonymise6() { using (var anonymiser = new Anonymiser(Key)) { foreach (var t in IPv6) { var expected = IPAddress.Parse(t.Key); var input = expected.GetAddressBytes(); var anonymised = anonymiser.Anonymise(input); var deanonymised = anonymiser.Deanonymise(anonymised); var actual = new IPAddress(deanonymised); Assert.AreEqual(expected, actual); } } }