Package org.apache.shiro.crypto.hash

Examples of org.apache.shiro.crypto.hash.Sha1Hash


     * Creates a new <em>uninitialized</em> {@link Sha1Hash Sha1Hash} instance, without it's byte array set.
     *
     * @return a new <em>uninitialized</em> {@link Sha1Hash Sha1Hash} instance, without it's byte array set.
     */
    protected AbstractHash newHashInstance() {
        return new Sha1Hash();
    }
View Full Code Here


    /**
     * This implementation merely returns
     * <code>new {@link Sha1Hash#Sha1Hash(Object, Object, int) Sha1Hash(credentials,salt,hashIterations)}</code>.
     */
    protected Hash hashProvidedCredentials(Object credentials, Object salt, int hashIterations) {
        return new Sha1Hash(credentials, salt, hashIterations);
    }
View Full Code Here

    public Class<? extends HashedCredentialsMatcher> getMatcherClass() {
        return Sha1CredentialsMatcher.class;
    }

    public AbstractHash hash(Object credentials) {
        return new Sha1Hash(credentials);
    }
View Full Code Here

    public Class<? extends HashedCredentialsMatcher> getMatcherClass() {
        return Sha1CredentialsMatcher.class;
    }

    public AbstractHash hash(Object credentials) {
        return new Sha1Hash(credentials);
    }
View Full Code Here

        //use SHA-1 hashing in this test:
        HashedCredentialsMatcher matcher = new HashedCredentialsMatcher(Sha1Hash.ALGORITHM_NAME);

        //simulate a user account with a SHA-1 hashed and salted password:
        ByteSource salt = new SecureRandomNumberGenerator().nextBytes();
        Object hashedPassword = new Sha1Hash("password", salt);
        SimpleAuthenticationInfo account = new SimpleAuthenticationInfo("username", hashedPassword, salt, "realmName");

        //simulate a username/password (plaintext) token created in response to a login attempt:
        AuthenticationToken token = new UsernamePasswordToken("username", "password");
View Full Code Here

        HashedCredentialsMatcher matcher = new HashedCredentialsMatcher(Sha1Hash.ALGORITHM_NAME);

        //simulate an account with SHA-1 hashed password (no salt)
        final String username = "username";
        final String password = "password";
        final Object hashedPassword = new Sha1Hash(password).getBytes();
        AuthenticationInfo account = new AuthenticationInfo() {
            public PrincipalCollection getPrincipals() {
                return new SimplePrincipalCollection(username, "realmName");
            }
View Full Code Here

        //simulate an account with SHA-1 hashed password, using the username as the salt
        //(BAD IDEA, but backwards-compatible):
        final String username = "username";
        final String password = "password";
        final Object hashedPassword = new Sha1Hash(password, username).getBytes();
        AuthenticationInfo account = new AuthenticationInfo() {
            public PrincipalCollection getPrincipals() {
                return new SimplePrincipalCollection(username, "realmName");
            }
View Full Code Here

     * hashCode expire time limit, 1 hour
     */
    public static final int HASH_EXPIRE_TIME_MILLISEC = 3600*1000;

    public static String generateResetHash(String loginId) {
        return new Sha1Hash(loginId, new SecureRandomNumberGenerator().nextBytes(), 1).toHex();
    }
View Full Code Here

TOP

Related Classes of org.apache.shiro.crypto.hash.Sha1Hash

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.