MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / get_algo_hexsum

Function get_algo_hexsum

src/packagedcode/npm.py:1438–1449  ·  view source on GitHub ↗

Return a mapping of {alogo: checksum in hex} given a prefixed checksum from an npm manifest.

(checksum)

Source from the content-addressed store, hash-verified

1436
1437
1438def get_algo_hexsum(checksum):
1439 """
1440 Return a mapping of {alogo: checksum in hex} given a prefixed checksum from
1441 an npm manifest.
1442 """
1443 if not checksum or '-' not in checksum:
1444 return {}
1445
1446 algo, _, checksum = checksum.partition('-')
1447 # value is base64 encoded: we convert to hex
1448 checksum = base64.b64decode(checksum.encode('ascii')).hex()
1449 return {algo: checksum}
1450
1451
1452def npm_homepage_url(namespace, name, registry='https://www.npmjs.com/package'):

Callers 4

parseMethod · 0.85
parseMethod · 0.85
parseMethod · 0.85
dist_mapperFunction · 0.85

Calls 1

encodeMethod · 0.45

Tested by

no test coverage detected