public void GenerateContentWithUmlautsAndCounterTest() { var key = MpAlgorithm.GetKeyForPassword("uÜ", "testÖ"); string password = MpAlgorithm.GenerateContent("Long Password", "strnÄ", key, 42, HashHMAC); Assert.AreEqual("Gasc3!YeluMoqb", password); }
public void GenerateContentWithUmlautsTest() { var key = MpAlgorithm.GetKeyForPassword("uÜ", "testÖ"); string password = MpAlgorithm.GenerateContent("Long Password", "strnÄ", key, 1, HashHMAC); Assert.AreEqual("YepiHedo1*Kada", password); }
public void GenerateContentTest() { var key = MpAlgorithm.GetKeyForPassword("u", "test"); string password = MpAlgorithm.GenerateContent("Long Password", "strn", key, 1, HashHMAC); Assert.AreEqual("LapdKebv2_Tele", password); }
public void GetKeyWithUmlautsTest() { var key = MpAlgorithm.GetKeyForPassword("uÜ", "testÖ"); sbyte[] expected = { -53, -69, -89, 48, 122, 56, 34, 13, -70, -103, 102, 90, -96, -75, 45, 68, 43, 67, 97, 60, 84, -90, 98, -95, -2, -2, 99, -60, -121, -2, -26, -45, 53, -31, 47, 0, -46, -97, 77, -41, 63, -15, -30, 60, 4, -120, 32, 122, -94, 42, 122, -103, -61, -115, 75, -123, -15, 47, 61, -100, -119, 115, 118, 82 }; Assert.IsTrue(expected.SequenceEqual(ToSignedByteArray(key))); }
public void GenerateKeyTest() { sbyte[] expectedRes = { -103, 59, -64, -27, 39, -62, 10, -76, -24, -28, -111, -75, 13, -128, -80, -101, 39, 41, -98, -22, -42, 61, -75, 38, -107, -40, 111, 61, 108, 63, 60, 82, 92, -39, 72, 14, 14, -26, 93, 67,83, 25, -32, 5, 32, 102, -126, 24, 15, 65, 9, 17, 0, 123, 91, 105, -46, -99, -64, 123, -12, 80, -37, -77 }; var result = MpAlgorithm.GetKeyForPassword("u", "test"); Assert.IsTrue(expectedRes.SequenceEqual(ToSignedByteArray(result))); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); /*_ioConnectionInfo = new IOConnectionInfo() { Path = "/mnt/sdcard/keepass/keechallenge.xml" }; * _ioConnectionInfoOut = new IOConnectionInfo() { Path = "/mnt/sdcard/keepass/keechallengeOut.xml" }; */ FindViewById <Button>(Resource.Id.MyButton1).Text = ""; Stopwatch sw = new Stopwatch(); sw.Start(); var key = new MpAlgorithm().GetKeyForPassword("u", "test"); sw.Stop(); string password = MpAlgorithm.GenerateContent("Long Password", "strn", key, 1, HashHMAC); FindViewById <Button>(Resource.Id.MyButton1).Text = password; FindViewById <Button>(Resource.Id.MyButton2).Text = sw.ElapsedMilliseconds.ToString(); // Get our button from the layout resource, // and attach an event to it FindViewById <Button>(Resource.Id.MyButton1).Click += (sender, args) => { // Decrypt(_ioConnectionInfo); }; FindViewById <Button>(Resource.Id.MyButton2).Click += (sender, args) => { //Decrypt(_ioConnectionInfoOut); }; FindViewById <Button>(Resource.Id.MyButton3).Click += (sender, args) => StartActivityForResult(typeof(PrefActivity), 1); }