HashFunction bits - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for HashFunction bits method.

This code example shows how to use the following methods:bits
 */ 
public class PasswordDigestService { 
  private static final Log log = LogFactory.getLog(PasswordDigestService.class);
 
  private static final HashFunction HASH_FUNCTION = Hashing.sha256();
  private static final int HASH_LENGTH = HASH_FUNCTION.bits() / Byte.SIZE;
  private static final int SECURE_SALT_LENGTH = HASH_LENGTH;
  private static final int LEGACY_SALT_LENGTH = 6;
 
  static { 
    assert SECURE_SALT_LENGTH != LEGACY_SALT_LENGTH;
  } 
 
  private static final Charset BYTE_ENCODING = Charsets.UTF_8;
  private static final BaseEncoding STRING_ENCODING = BaseEncoding.base16().lowerCase();
 
 
  private final Random random;
 
  public PasswordDigestService() { 
4
CodeRank
This code example shows how to use the following methods:bits
 
    private static final int NUM_CHARS;
    static { 
        HASH_FUNCTION = Hashing.sha1();
 
        NUM_BYTES = HASH_FUNCTION.bits() / 8;
 
        NUM_CHARS = 2 * NUM_BYTES;
 
        NULL = new ObjectId(new byte[20]);
    } 
 
    private final byte[] hashCode;
 
    /** 
     * Constructs a new {@code NULL} object id. 
     */ 
    public ObjectId() { 
        this.hashCode = NULL.hashCode;
    } 
3
CodeRank
This code example shows how to use the following methods:bits
public class EncryptedSearchPrivateKey { 
    public static final String        HASH_COLLAPSER        = "hashCollapser";
    public static final String        LEFT_SQUARING_MATRIX  = "leftMatrix";
    public static final String        RIGHT_SQUARING_MATRIX = "rightMatrix";
    private static final HashFunction hf                    = Hashing.murmur3_128();
    private static final int          hashBits              = hf.bits();
 
    private final EnhancedBitMatrix   leftSquaringMatrix, rightSquaringMatrix;
 
    @JsonCreator 
    public EncryptedSearchPrivateKey( 
            @JsonProperty( LEFT_SQUARING_MATRIX ) EnhancedBitMatrix leftSquaringMatrix,
            @JsonProperty( RIGHT_SQUARING_MATRIX ) EnhancedBitMatrix rightSquaringMatrix ) throws SingularMatrixException {
        this.leftSquaringMatrix = leftSquaringMatrix;
        this.rightSquaringMatrix = rightSquaringMatrix;
    } 
 
    public EncryptedSearchPrivateKey( int sqrRootHashLength ) throws SingularMatrixException {
        this.leftSquaringMatrix = EnhancedBitMatrix.randomInvertibleMatrix( sqrRootHashLength );
        this.rightSquaringMatrix = EnhancedBitMatrix.randomInvertibleMatrix( sqrRootHashLength );
3
CodeRank
bits Method Overview
Returns the number of bits (a multiple of 32) that each hash code produced by this hash function has.
See Code Examples for other Guava HashFunction Methods: