Ejemplo n.º 1
0
        public void TestHashEquality()
        {
            var ben        = Cryptonite.Hash("Ben");
            var anotherBen = Cryptonite.Hash("Ben");

            TestContext.Out.WriteLine(ben);
            Assert.AreNotEqual(ben, anotherBen);
        }
Ejemplo n.º 2
0
        public void TestHashVerification()
        {
            var passwordHash = Cryptonite.Hash("Benjamin");

            const string correctPassword   = "******";
            const string incorrectPassword = "******";

            Assert.True(Cryptonite.Verify(correctPassword, passwordHash));
            Assert.False(Cryptonite.Verify(incorrectPassword, passwordHash));
        }
Ejemplo n.º 3
0
 public UserProfile()
 {
     CreateMap <CreateUserRequest, User>()
     .ForMember(dest => dest.PasswordHash,
                opt =>
                opt.MapFrom(src => Cryptonite.Hash(src.Password)))
     .ForMember(dest => dest.Token,
                opt =>
                opt.MapFrom(src => Tokenizer.CreateTimestampedToken()));
 }