HashFunction hashString - 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 hashString method.

This code example shows how to use the following methods:hashString
		float hue = floatFromText(text, 0f, 1f);
		return HSBtoColor(hue, SATURATION, LIGHTNESS);
	} 
 
	private static float floatFromText(String text, float low, float high) {
		int hash = HASH_FUNCTION.hashString(text, Charsets.UTF_8).asInt();
		 
		final float old_min = Integer.MIN_VALUE;
		final float old_max = Integer.MAX_VALUE;
		float hue = ((hash - old_min) / (old_max - old_min)) * (high - low);
		 
		// Return limited in range (low, high) 
		return Math.max(low, Math.min(hue, high));
	} 
 
	/** 
	 * Adapted from Color.java in Android 
	 *  
	 * See https://github.com/android/platform_frameworks_base/blob/master/graphics/java/android/graphics/Color.java 
	 */ 
5
CodeRank
This code example shows how to use the following methods:hashString
    } 
 
    @Override 
    public int hashCode() 
    { 
        return HASH_FUNCTION.hashString(_dn + _delegationId, UTF_8).asInt();
    } 
 
    @Override 
    public boolean equals(Object otherRaw) 
    { 
        if (otherRaw == this) {
            return true; 
        } 
 
        if(!(otherRaw instanceof DelegationIdentity)) { 
            return false; 
        } 
 
        DelegationIdentity other = (DelegationIdentity) otherRaw;
4
CodeRank
This code example shows how to use the following methods:hashString
     * @param strToHash 
     * @return the {@code ObjectId} generated from the string 
     */ 
    public static ObjectId forString(final String strToHash) {
        Preconditions.checkNotNull(strToHash);
        HashCode hashCode = HASH_FUNCTION.hashString(strToHash, Charset.forName("UTF-8"));
        return new ObjectId(hashCode.asBytes(), false);
    } 
 
    /** 
     * Returns the value of this ObjectId's internal hash at the given index without having to go 
     * through {@link #getRawValue()} and hence create excessive defensive copies of the byte array. 
     *  
     * @param index the index of the byte inside this objectid's internal hash to return 
     * @return the byte at the given index as an integer 
     */ 
    public int byteN(int index) {
        int b = this.hashCode[index] & 0xFF;
        return b;
    } 
3
CodeRank
This code example shows how to use the following methods:hashString
This code example shows how to use the following methods:hashString
        return publicKey.getEncrypter().apply(
                BitVectors.concatenate( searchHash, BitVectors.randomVector( searchHash.size() ) ) );
    } 
 
    public BitVector hash( String term ) {
        BitVector hash = BitVectors.fromBytes( hashBits, hf.hashString( term, Charsets.UTF_8 ).asBytes() );
        BitVector halfHash = hash.partFromTo( 0, 63 );
        halfHash.xor( hash.partFromTo( 64, 127 ) );
        return halfHash;
    } 
 
    @JsonProperty( LEFT_SQUARING_MATRIX )
    public EnhancedBitMatrix getLeftSquaringMatrix() { 
        return leftSquaringMatrix;
    } 
 
    @JsonProperty( RIGHT_SQUARING_MATRIX )
    public EnhancedBitMatrix getRightSquaringMatrix() { 
        return rightSquaringMatrix;
    } 
3
CodeRank
hashString Method Overview
Shortcut for newHasher().putString(input, charset).hash().
See Code Examples for other Guava HashFunction Methods: