Returns a list of subresource integrity Hash objects parsed from a str

    >>> parse('  sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= ')
    ... # doctest: +ELLIPSIS
    [subresource_integrity.Hash('sha256', '47DEQp...SuFU=', '')]

    Hash objects are put in descending order of algorithmic strength

    >>> parse('sha384-dOTZf16X8p34q2/kYyEFm0jh89uTjikhnzjeLeF0FHsEaYKb'
    ...       '1A1cv+Lyv4Hk8vHd'
    ...       ' '
    ...       'sha512-Q2bFTOhEALkN8hOms2FKTDLy7eugP2zFZ1T8LCvX42Fp3WoN'
    ...       'r3bjZSAHeOsHrbV1Fu9/A0EzCinRE7Af1ofPrw=='
    ... )
    ... # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
    [subresource_integrity.Hash('sha512', 'Q2b...zCinRE7Af1ofPrw==', ''),
     subresource_integrity.Hash('sha384', 'dOT...Hk8vHd', '')]

    Unrecognised hash algorithms are discarded

    >>> parse('sha1-2jmj7l5rSw0yVb/vlWAYkK/YBwk=')
    []

def parse(integrity):
    """Returns a list of subresource integrity Hash objects parsed from a str

    >>> parse('  sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= ')
    ... # doctest: +ELLIPSIS
    [subresource_integrity.Hash('sha256', '47DEQp...SuFU=', '')]

    Hash objects are put in descending order of algorithmic strength

    >>> parse('sha384-dOTZf16X8p34q2/kYyEFm0jh89uTjikhnzjeLeF0FHsEaYKb'
    ...       '1A1cv+Lyv4Hk8vHd'
    ...       ' '
    ...       'sha512-Q2bFTOhEALkN8hOms2FKTDLy7eugP2zFZ1T8LCvX42Fp3WoN'
    ...       'r3bjZSAHeOsHrbV1Fu9/A0EzCinRE7Af1ofPrw=='
    ... )
    ... # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
    [subresource_integrity.Hash('sha512', 'Q2b...zCinRE7Af1ofPrw==', ''),
     subresource_integrity.Hash('sha384', 'dOT...Hk8vHd', '')]

    Unrecognised hash algorithms are discarded

    >>> parse('sha1-2jmj7l5rSw0yVb/vlWAYkK/YBwk=')
    []
    """
    matches = _INTEGRITY_PATTERN.findall(integrity)
    matches.sort(key=lambda t: RECOGNISED_ALGORITHMS.index(t[0]))
    return [Hash.fromhash(*match) for match in matches]