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

Function tokens_hash

src/licensedcode/match_hash.py:44–49  ·  view source on GitHub ↗

Return a digest binary string computed from a sequence of numeric token ids.

(tokens)

Source from the content-addressed store, hash-verified

42
43
44def tokens_hash(tokens):
45 """
46 Return a digest binary string computed from a sequence of numeric token ids.
47 """
48 as_bytes = array('h', tokens).tobytes()
49 return sha1(as_bytes).digest()
50
51
52def index_hash(rule_tokens):

Callers 2

index_hashFunction · 0.85
hash_matchFunction · 0.85

Calls 2

sha1Function · 0.85
digestMethod · 0.80

Tested by

no test coverage detected