Checks if the specified string is a valid SHA-1 value.

@param {string} str
@returns {boolean} `true` if `str` represents a valid SHA-1, otherwise `false`
767308
function isValidSha(str) {
  if (typeof str === 'string' && str.length === 40) {
    const res = str.match(/[0-9a-f]/g);
    return res && res.length === 40;
  }
  return false;
}
268196
private boolean isEqual(String str1, String str2) {
		if (StringUtils.isEmpty(str1) && StringUtils.isEmpty(str2)) {
			return true;
		} else if (!StringUtils.isEmpty(str1)) {
			return str1.equals(str2);
		} else {
			return false;
		}
	}
308508
public static int jsHash(String str) {
		int hash = 1315423911;

		for (int i = 0; i < str.length(); i++) {
			hash ^= ((hash << 5) + str.charAt(i) + (hash >> 2));
		}

		return hash & 0x7FFFFFFF;
	}
850349
public static int sdbmHash(String str) {
		int hash = 0;

		for (int i = 0; i < str.length(); i++) {
			hash = str.charAt(i) + (hash << 6) + (hash << 16) - hash;
		}

		return hash & 0x7FFFFFFF;
	}
506859
private static function IsValidReplacementString( $str )
	{
		// $charArr = explode( "", $str);
		for ( $k = 0; $k < strlen( $str ); $k++ )
		{
		    if ( $str[ $k ] == '\\' )
		    {
			   if ( $k < strlen( $str ) - 1 && ( $str[ $k + 1 ] == '\\' || $str[ $k + 1 ] == '$' ) )
				  $k++;
			   else
				  return false;
		    }
		    if ( $str[ $k ] == '$' )
		    {
			   if ( $k < strlen( $str ) - 1 && is_numeric( $str[ $k + 1 ] ) )
				  $k++;
			   else
				  return false;
		    }
		}
		return true;
	}
816641
function sha1(str) {
	      var utf8 = utf8Encode(str);
	      var words32 = stringToWords32(utf8);
	      var len = utf8.length * 8;
	      var w = new Array(80);
	      var _a = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0], a = _a[0], b = _a[1], c = _a[2], d = _a[3], e = _a[4];
	      words32[len >> 5] |= 0x80 << (24 - len % 32);
	      words32[((len + 64 >> 9) << 4) + 15] = len;
	      for (var i = 0; i < words32.length; i += 16) {
	          var _b = [a, b, c, d, e], h0 = _b[0], h1 = _b[1], h2 = _b[2], h3 = _b[3], h4 = _b[4];
	          for (var j = 0; j < 80; j++) {
	              if (j < 16) {
	                  w[j] = words32[i + j];
	              }
	              else {
	                  w[j] = rol32(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
	              }
	              var _c = fk(j, b, c, d), f = _c[0], k = _c[1];
	              var temp = [rol32(a, 5), f, e, k, w[j]].reduce(add32);
	              _d = [d, c, rol32(b, 30), a, temp], e = _d[0], d = _d[1], c = _d[2], b = _d[3], a = _d[4];
	          }
	          _e = [add32(a, h0), add32(b, h1), add32(c, h2), add32(d, h3), add32(e, h4)], a = _e[0], b = _e[1], c = _e[2], d = _e[3], e = _e[4];
	      }
	      var sha1 = words32ToString([a, b, c, d, e]);
	      var hex = '';
	      for (var i = 0; i < sha1.length; i++) {
	          var b_1 = sha1.charCodeAt(i);
	          hex += (b_1 >>> 4 & 0x0f).toString(16) + (b_1 & 0x0f).toString(16);
	      }
	      return hex.toLowerCase();
	      var _d, _e;
	  }
215034
public static boolean is_ashanta(String str)
    {

        String s1 = VarnaUtil.getAntyaVarna(str);
        if (is_ash(s1)) return true;
        return false;
    }
213029
function isCSB (str, index, quote) {
    if (str.charAt(index+1) === RSB) {
        return {
            str: quote + RSB,
            index: index,
            quote: quote,
            jump: 1
        };
    }
}
1295806
public static String fingerprint(String str) {
		try {
			MessageDigest md = MessageDigest.getInstance("SHA-1");
			return byteArrayToHexString(md.digest(str.getBytes()));
		}
		catch (NoSuchAlgorithmException nsae) {
			LOGGER.warning("Unable to calculate the fingerprint for string [" + str + "].");
			return null;
		}
	}
971184
@Trivial
    private boolean isStringValueUndefined(Object str) {
        if (str instanceof SerializableProtectedString) {
            // Avoid constructing a String from a ProtectedString
            char[] contents = ((SerializableProtectedString) str).getChars();
            for (char ch : contents)
                if (ch > '\u0020')
                    return false; // See the description of String.trim()
            return true;
        } else {
            return (str == null || ((String) str).trim().isEmpty());
        }

    }
954240
public static int dekHash(String str) {
		int hash = str.length();

		for (int i = 0; i < str.length(); i++) {
			hash = ((hash << 5) ^ (hash >> 27)) ^ str.charAt(i);
		}

		return hash & 0x7FFFFFFF;
	}
620329
function(str){
	var retstr = str;

	if( ! us.isUndefined(str) && str.length > 2 ){
	    var end = str.length -1;
	    if( str.charAt(0) == '"' && str.charAt(end) == '"' ){
		retstr = str.substr(1, end -1);
	    }
	}

	return retstr;
    }
837134
public static int apHash(String str) {
		int hash = 0;

		for (int i = 0; i < str.length(); i++) {
			hash ^= ((i & 1) == 0) ? ((hash << 7) ^ str.charAt(i) ^ (hash >> 3)) : (~((hash << 11) ^ str.charAt(i) ^ (hash >> 5)));
		}

		// return (hash & 0x7FFFFFFF);
		return hash;
	}
66689
function hash(str, prime) {
            utils.dassert(isValue(str));
            var hash = 5381;
            if(isValue(prime)) {
                hash = prime;
            }
            var len = str.length;
            for(var i = 0; i < len; i++) {
                hash = ((hash << 5) - hash) + str.charCodeAt(i);
                hash = hash & hash;
            }
            return hash;
        }
503847
public static String encodeToSafeAsciiFileNameString(String str, Charset strCharset) {
        if (str == null) {
            return str;
        }
        if (!SAFE_ASCII_PATTERN.matcher(str).matches()) {
            return calcSHA1Digest(str, strCharset);
        }
        // encode again since if str is SHA1 digest
        // it can easily conflict with the other encoded string
        if (SHA1_DIGEST_PATTERN.matcher(str).matches()) {
            return calcSHA1Digest(str, strCharset);
        }
        return str;
    }
902777
private int rollHash(int hashvalue, String str, int i) {
    // 'roll' hash
    char outchar = str.charAt(str.length() - 1 - i);
    char inchar = str.charAt(str.length() - _block - 1 - i);
    hashvalue = A * hashvalue + CHAR_HASHES[inchar] - _Apowblock * CHAR_HASHES[outchar];
    return hashvalue;
  }
897159
function(str) {
    var startsWith = !_.isNull(str.match(sOpsHeadRe))
    return startsWith & cons.isLegalSentence(str)
  }