using NUnit.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; namespace ServiceOutsideTests.Crypto { public class MD5 { [Test] public void EncryptDecrypt() { Assert.IsTrue(ServiceShared.Crypto.MD5.Encrypt("dasd hsadhuiahdiashd uihas uidhasi hdiuashd uihasid asd asd sa") == "63754a7803f653217f6b46e048e5c286"); Assert.IsTrue(ServiceShared.Crypto.MD5.Encrypt("Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"); for (int i = 0; i < 1000; i++) { int KeySize = new Random().Next(1, 4096); byte[] random = new byte[KeySize]; RandomNumberGenerator.Fill(random); string key = Encoding.UTF8.GetString(random); Assert.IsTrue(ServiceShared.Crypto.MD5.Encrypt(key).Length == 32); } } } }