static void Main(string[] args) { CreateHash hash = new CreateHash(); Console.WriteLine(hash.MakeHash(HashType.SHA1, "valami")); Console.ReadKey(); }
public void TestMd5(string elvart, string szoveg) { CreateHash hash = new CreateHash(); var sut = hash.MakeHash(HashType.MD5, szoveg); Assert.AreEqual(elvart, sut); }
public void SHA512Test(string szoveg, string elvart) { CreateHash hash = new CreateHash(); var sut = hash.MakeHash(HashType.SHA512, szoveg); Assert.AreEqual(elvart, sut); }
protected override void OnModelCreating(ModelBuilder builder) { builder.Entity <UserRoles>() .HasKey(bc => new { bc.UserId, bc.RoleId }); builder.Entity <UserRoles>() .HasOne(bc => bc.User) .WithMany(b => b.UserRoles) .HasForeignKey(x => x.UserId); builder.Entity <UserRoles>() .HasOne(bc => bc.Role) .WithMany(bc => bc.UserRoles) .HasForeignKey(x => x.RoleId); Role adminRole = new Role { RoleId = 1, RoleName = "Admin" }; Role userRole = new Role { RoleId = 2, RoleName = "User" }; builder.Entity <Role>().HasData(new Role[] { adminRole, userRole }); User adminUser = new User { UserId = 1, Email = "*****@*****.**", Password = CreateHash.GetHashString("admin1203"), Name = "Admin", SurName = "Adminovich", IsDelete = false }; User odenryUser = new User { UserId = 2, Email = "*****@*****.**", Password = CreateHash.GetHashString("user123"), Name = "Golden", SurName = "Coffild", IsDelete = false }; builder.Entity <User>().HasData(new User[] { adminUser, odenryUser }); UserRoles userRoles = new UserRoles { RoleId = adminRole.RoleId, UserId = adminUser.UserId }; UserRoles odenryRole = new UserRoles { RoleId = userRole.RoleId, UserId = odenryUser.UserId }; builder.Entity <UserRoles>().HasData(new UserRoles[] { userRoles, odenryRole }); base.OnModelCreating(builder); }
public void TestSHA512(string elvart, string szoveg) { //Arrange CreateHash hash = new CreateHash(); //Act var sut = hash.MakeHash(HashType.SHA512, szoveg); //Assert Assert.AreEqual(elvart, sut); }
static void Main(string[] args) { CreateHash hash = new CreateHash(); Console.WriteLine(hash.MakeHash(HashType.MD5, "Valami")); Console.WriteLine(hash.MakeHash(HashType.MD5, "Valami", true)); Console.WriteLine(hash.MakeHash(HashType.SHA512, "Valami")); Console.WriteLine(hash.MakeHash(HashType.SHA512, "Valami", true)); Console.ReadKey(); }
protected override void OnModelCreating(ModelBuilder builder) { Users newUser = new Users { UserId = 1, UserName = "******", Password = CreateHash.GetHashString("123456") }; builder.Entity <Users>().HasData(new Users[] { newUser }); base.OnModelCreating(builder); }