Returns the wire format string and the hash module to use for the
    specified TSIG algorithm

    @rtype: (string, hash constructor)
    @raises NotImplementedError: I{algorithm} is not supported
517095
def get_algorithm(algorithm):
    

    global _hashes
    if _hashes is None:
        _setup_hashes()

    if isinstance(algorithm, (str, unicode)):
        algorithm = dns.name.from_text(algorithm)

    if sys.hexversion < 0x02050200 and \
       (algorithm == HMAC_SHA384 or algorithm == HMAC_SHA512):
        raise NotImplementedError("TSIG algorithm " + str(algorithm) +
                                  " requires Python 2.5.2 or later")

    try:
        return (algorithm.to_digestable(), _hashes[algorithm])
    except KeyError:
        raise NotImplementedError("TSIG algorithm " + str(algorithm) +
                                  " is not supported")
304532
def get_molecule_hash(self, mol):
        
        obconv = ob.OBConversion()
        obconv.SetOutFormat(str("inchi"))
        obconv.AddOption(str("X"), ob.OBConversion.OUTOPTIONS, str("DoNotAddH"))
        inchi_text = obconv.WriteString(mol)
        match = re.search(r"InChI=(?P<inchi>.+)\n", inchi_text)
        return match.group("inchi")
814213
def get_hash(self):
        
        if not self.executed:
            raise pyhsm.exception.YHSM_Error("HMAC-SHA1 hash not available, before execute().")
        return self.result.hash_result
943306
def get_hash(self, length=HASH_LENGTH):
        

        data_hash = ""
        if not self.data_str:
            return data_hash

        encoded_data_str = self.data_str
        if sys.version_info.major == 2:
            # In Py2, only unicode needs to be encoded.
            if isinstance(self.data_str, unicode):
                encoded_data_str = self.data_str.encode('utf-8')
        else:
            # data_str should always be unicode on python 3
            encoded_data_str = self.data_str.encode('utf-8')

        data_hash = hashlib.sha1(encoded_data_str).hexdigest()

        return data_hash[:length]
825503
function getHash(str, algorithm) {
  algorithm = algorithm || 'md5';
  var hash = crypto.createHash(algorithm);
  hash.end(str);
  return hash.read();
}
604719
def hash(self, *args, **kwargs):
        
        joiner = kwargs.get('joiner', '').encode('utf-8')
        as_bytes = kwargs.get('as_bytes', False)

        def conv(arg):
            if isinstance(arg, integer_types):
                arg = int_to_bytes(arg)

            if PY3:
                if isinstance(arg, str):
                    arg = arg.encode('utf-8')
                return arg

            return str(arg)

        digest = joiner.join(map(conv, args))

        hash_obj = self._hash_func(digest)

        if as_bytes:
            return hash_obj.digest()

        return int_from_hex(hash_obj.hexdigest())
1060511
private String hash(String dataId)
   {
      try
      {
         MessageDigest digest = MessageDigest.getInstance(hashAlgorithm);
         digest.update(dataId.getBytes("UTF-8"));
         return new BigInteger(1, digest.digest()).toString(32);
      }
      catch (NumberFormatException e)
      {
         throw new RuntimeException("Could not generate the hash code of '" + dataId + "' with the algorithm '"
            + hashAlgorithm + "'", e);
      }
      catch (UnsupportedEncodingException e)
      {
         throw new RuntimeException("Could not generate the hash code of '" + dataId + "' with the algorithm '"
            + hashAlgorithm + "'", e);
      }
      catch (NoSuchAlgorithmException e)
      {
         throw new RuntimeException("Could not generate the hash code of '" + dataId + "' with the algorithm '"
            + hashAlgorithm + "'", e);
      }
   }
360671
def _StructPackDecoder(wire_type, format):
  

  value_size = struct.calcsize(format)
  local_unpack = struct.unpack

  # Reusing _SimpleDecoder is slightly slower than copying a bunch of code, but
  # not enough to make a significant difference.

  # Note that we expect someone up-stack to catch struct.error and convert
  # it to _DecodeError -- this way we don't have to set up exception-
  # handling blocks every time we parse one value.

  def InnerDecode(buffer, pos):
    new_pos = pos + value_size
    result = local_unpack(format, buffer[pos:new_pos])[0]
    return (result, new_pos)
  return _SimpleDecoder(wire_type, InnerDecode)
674281
def hash(self):
        '''
        
        '''
        if self._hash is None:
            self._initialize()
            self._hash = khash(type(self).__name__, self._default_value, self._fuzzable)
        return self._hash
425647
def hash(self):
        '''
        
        '''
        hashed = super(_LibraryBitField, self).hash()
        return khash(hashed, self._length, self._signed, self._min_value, self._max_value)
1010930
def get_hash(self):
        
        if self._hash is None:
            self._hash = self._source.get_hash(self._handle).strip()
        return self._hash
1124334
def qhashform(o):
    '''
    
    '''
    if is_quantity(o): return ('__#quant', qhashform(mag(o)), str(o.u))
    elif isinstance(o, np.ndarray) and np.issubdtype(o.dtype, np.dtype(np.number).type):
        return ('__#ndarray', o.tobytes())
    elif isinstance(o, (set, frozenset)): return ('__#set', tuple([qhashform(x) for x in o]))
    elif is_map(o): return ps.pmap({qhashform(k):qhashform(v) for (k,v) in six.iteritems(o)})
    elif is_str(o): return o
    elif hasattr(o, '__iter__'): return tuple([qhashform(u) for u in o])
    else: return o
1300484
def get_hash(self, msg):
        '''
        
        '''
        msg = msg.encode('utf-8', 'replace')
        return hashlib.sha1(msg).hexdigest()
875623
def GetStructFormatString(self):
    
    if not self._element_data_type_map:
      return None

    number_of_elements = None
    if self._data_type_definition.elements_data_size:
      element_byte_size = self._element_data_type_definition.GetByteSize()
      if element_byte_size is None:
        return None

      number_of_elements, _ = divmod(
          self._data_type_definition.elements_data_size, element_byte_size)

    elif self._data_type_definition.number_of_elements:
      number_of_elements = self._data_type_definition.number_of_elements

    format_string = self._element_data_type_map.GetStructFormatString()
    if not number_of_elements or not format_string:
      return None

    return '{0:d}{1:s}'.format(number_of_elements, format_string)
504717
def _get_hash():
    '''
    
    '''
    # Using bitmask to emulate rollover behavior of C unsigned 32 bit int
    bitmask = 0xffffffff
    h = 0

    for i in bytearray(salt.utils.stringutils.to_bytes(__grains__['id'])):
        h = (h + i) & bitmask
        h = (h + (h << 10)) & bitmask
        h = (h ^ (h >> 6)) & bitmask

    h = (h + (h << 3)) & bitmask
    h = (h ^ (h >> 11)) & bitmask
    h = (h + (h << 15)) & bitmask

    return (h & (_HASH_SIZE - 1)) & bitmask
604947
public final DataHash getHash() {
        if (outputHash == null) {
            byte[] hash = messageDigest.digest();
            outputHash = new DataHash(algorithm, hash);
        }
        return outputHash;
    }
96891
def hash_type_to_saml_name_id_format(hash_type):
    
    msg = "hash_type_to_saml_name_id_format is deprecated and will be removed."
    _warnings.warn(msg, DeprecationWarning)

    hash_type_to_name_id_format = {
        UserIdHashType.transient: NAMEID_FORMAT_TRANSIENT,
        UserIdHashType.persistent: NAMEID_FORMAT_PERSISTENT,
        UserIdHashType.emailaddress: NAMEID_FORMAT_EMAILADDRESS,
        UserIdHashType.unspecified: NAMEID_FORMAT_UNSPECIFIED,
    }

    return hash_type_to_name_id_format.get(hash_type, NAMEID_FORMAT_PERSISTENT)