Package com.google.common.hash

Examples of com.google.common.hash.HashFunction.newHasher()


        Murmur3HashFunction murmur3 = new Murmur3HashFunction();
        HashFunction guavaMurmur3 = Hashing.murmur3_32();
        for (int i = 0; i < 100; ++i) {
            final String id = RandomStrings.randomRealisticUnicodeOfCodepointLength(getRandom(), RandomInts.randomIntBetween(getRandom(), 1, 20));
            //final String id = "0";
            final int hash1 = guavaMurmur3.newHasher().putUnencodedChars(id).hash().asInt();
            final int hash2 = murmur3.hash(id);
            assertEquals(hash1, hash2);
        }
    }
View Full Code Here


            final Person customer = (Person) request.getSession().getAttribute("customer");
            PasswordGenerator generator = Generator.newPasswordGenerator(8, true, true, true, true);
            try {
                final String password = generator.generate();
                HashFunction hf = Hashing.sha1();
                HashCode hc = hf.newHasher()
                    .putString(password)
                    .hash();
                customer.setPassword(hc.toString());
                customer.addAccount(account);
                customerService.processCustomer(customer, password);
View Full Code Here

            throws ServletException, IOException {
        final String email = request.getParameter("mail");
        final String password = request.getParameter("password");
       
        HashFunction hf = Hashing.sha1();
        HashCode hc = hf.newHasher()
                .putString(password)
                .hash();
       
        final String hashedPassword = hc.toString();
      
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.