Returns the unique thumbprint for a {JOSE::JWK JOSE::JWK} using the `digest_type`.

 @see JOSE::JWK.thumbprint
 @see https://tools.ietf.org/html/rfc7638 RFC 7638 - JSON Web Key (JWK) Thumbprint
 @param [String] digest_type
 @return [String]
496523
def thumbprint(digest_type = nil)
      digest_type ||= 'SHA256'
      thumbprint_binary = JOSE.encode(to_thumbprint_map)
      return JOSE.urlsafe_encode64(OpenSSL::Digest.new(digest_type).digest(thumbprint_binary))
    end
23173
def hash(self, key, message=None):
		
		hmac_obj = hmac.HMAC(key, self.__digest_generator, backend=default_backend())
		if message is not None:
			hmac_obj.update(message)
		return hmac_obj.finalize()
1288995
public String digest(String message) {

        try {
            Mac mac = Mac.getInstance(algorithm);
            SecretKeySpec macKey = new SecretKeySpec(key, algorithm);
            mac.init(macKey);
            byte[] digest = mac.doFinal(ByteArray.fromString(message));
            return ByteArray.toHex(digest);
        } catch (NoSuchAlgorithmException e) {
            throw new IllegalStateException("Algorithm unavailable: " + algorithm, e);
        } catch (InvalidKeyException e) {
            throw new IllegalArgumentException("Unable to construct key for " + algorithm
                    + ". Please check the value passed in when this class was initialised.", e);
        }
    }
196234
def decrypt_ascii(self, ascii_string, key=None, digest="hex"):
        
        digests = {"hex": binascii.a2b_hex,
                   "base64": binascii.a2b_base64,
                   "hqx": binascii.a2b_hqx}
        digestor = digests.get(digest)
        if not digestor:
            TripleSecError(u"Digestor not supported.")

        binary_string = digestor(ascii_string)
        result = self.decrypt(binary_string, key)
        return result
1053770
def match_mime_type_keys(hash, mime_type)
      type, subtype = mime_type.split('/', 2)
      [
        hash["*"],
        hash["*/*"],
        hash["#{type}/*"],
        hash["#{type}/#{subtype}"]
      ].compact
    end
741208
def certificates
      return Hash[self.signs.map{|path, sign| [path, sign.certificates.first] }]
    end
937427
def get_signature_hash(params, secret)
      Digest::MD5.hexdigest(get_signature_string(params, secret)).to_s
    end
611705
def check_signature(secret)
      digest = OpenSSL::Digest::SHA256.new
      expected = OpenSSL::HMAC.hexdigest(digest, secret, @body)
      if @signature == expected
        return true
      else
        Pusher.logger.warn "Received WebHook with invalid signature: got #{@signature}, expected #{expected}"
        return false
      end
    end
1155052
def __get_jwks_key(self, jwks_uri, **kwargs):
        
        jwks_key = kwargs.pop('jwks_key', None)
        if not jwks_key:
            res = self._session.get(jwks_uri)
            res.raise_for_status()
            jwks_key = res.json()

        self.jwks_key_set = None
        self.jwks_key = None
        if 'keys' in jwks_key:
            self.jwks_key_set = {}
            for jwks in jwks_key['keys']:
                self.jwks_key_set[jwks['kid']] = jwks
        else:
            self.jwks_key = jwks_key
548995
function digest(message) {
    return message.id || sha1(serializeNodes(message.nodes).join('') + ("[" + message.meaning + "]"));
}
15635
def update_digest

    path = self.bundle_dir
    sha = Digest::SHA2.new
    bundle_sha = Digest::SHA2.new

    digests = []
    Dir.glob("#{path}/**/*").sort.each do |f|
      next if File.directory?(f) || File.basename(f) == "digest" || f =~ /^#{path}\/test/
      bundle_sha.file(f)
      sha.reset()
      digests << { :file => f.gsub(/#{path}\//, ''), :digest => sha.file(f).hexdigest() }
    end

    @digest = { :digest => bundle_sha.hexdigest(), :files => digests }
    File.open(path+"/digest", 'w'){ |f|
      f.write(MultiJson.dump(@digest, :pretty => true, :adapter => :json_gem) + "\n")
    }

  end
883479
def _path_hash(path, transform, kwargs):
    
    sortedargs = ["%s:%r:%s" % (key, value, type(value))
                  for key, value in sorted(iteritems(kwargs))]
    srcinfo = "{path}:{transform}:{{{kwargs}}}".format(path=os.path.abspath(path),
                                                   transform=transform,
                                                   kwargs=",".join(sortedargs))
    return digest_string(srcinfo)
189995
private static String encodeCacheKey(OcspResponseCacheKey ocsp_cache_key)
  {
    try
    {
      DigestCalculator digest = new SHA1DigestCalculator();
      AlgorithmIdentifier algo = digest.getAlgorithmIdentifier();
      ASN1OctetString nameHash = ASN1OctetString.getInstance(ocsp_cache_key.nameHash);
      ASN1OctetString keyHash = ASN1OctetString.getInstance(ocsp_cache_key.keyHash);
      ASN1Integer snumber = new ASN1Integer(ocsp_cache_key.serialNumber);
      CertID cid = new CertID(algo, nameHash, keyHash, snumber);
      return Base64.encodeBase64String(cid.toASN1Primitive().getEncoded());
    }
    catch (Exception ex)
    {
      LOGGER.debug("Failed to encode cache key to base64 encoded cert id");
    }
    return null;
  }
241145
def sign(jwk, jws = nil, header = nil)
      plain_text = to_binary
      if jws.nil?
        jwk = JOSE::JWK.from(jwk)
        jws = jwk.signer
      end
      jws = JOSE::JWS.from(jws).to_map
      if not jws.has_key?('typ')
        jws = jws.put('typ', 'JWT')
      end
      return JOSE::JWK.sign(plain_text, jws, jwk, header)
    end
671342
public static String getShaVersion(String digest) {
        return StringUtils.substring(digest, 0, StringUtils.indexOf(digest, ":"));
    }
592152
def digest(type = :sha1)
      case type
      when :sha1
        Digest::SHA1.hexdigest(@bindata)
      when :sha256
        Digest::SHA256.hexdigest(@bindata)
      when :md5
        Digest::MD5.hexdigest(@bindata)
      else
        raise ArgumentError
      end
    end
170952
def _get_keyid(keytype, scheme, key_value, hash_algorithm = 'sha256'):
  """"""

  # 'keyid' will be generated from an object conformant to KEY_SCHEMA,
  # which is the format Metadata files (e.g., root.json) store keys.
  # 'format_keyval_to_metadata()' returns the object needed by _get_keyid().
  key_meta = format_keyval_to_metadata(keytype, scheme, key_value, private=False)

  # Convert the key to JSON Canonical format, suitable for adding
  # to digest objects.
  key_update_data = securesystemslib.formats.encode_canonical(key_meta)

  # Create a digest object and call update(), using the JSON
  # canonical format of 'rskey_meta' as the update data.
  digest_object = securesystemslib.hash.digest(hash_algorithm)
  digest_object.update(key_update_data.encode('utf-8'))

  # 'keyid' becomes the hexadecimal representation of the hash.
  keyid = digest_object.hexdigest()

  return keyid