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

Function get_hashed_path

src/packagedcode/cocoapods.py:90–110  ·  view source on GitHub ↗

Returns a string with a part of the file path derived from the md5 hash. From https://github.com/CocoaPods/cdn.cocoapods.org: "There are a set of known prefixes for all Podspec paths, you take the name of the pod, create a hash (using md5) of it and take the first t

(name)

Source from the content-addressed store, hash-verified

88
89
90def get_hashed_path(name):
91 """
92 Returns a string with a part of the file path derived from the md5 hash.
93
94 From https://github.com/CocoaPods/cdn.cocoapods.org:
95 "There are a set of known prefixes for all Podspec paths, you take the
96 name of the pod, create a hash (using md5) of it and take the first
97 three characters."
98
99 """
100 if not name:
101 return
102 podname = get_podname_proper(name)
103 if name != podname:
104 name_to_hash = podname
105 else:
106 name_to_hash = name
107
108 hash_init = get_first_three_md5_hash_characters(name_to_hash)
109 hashed_path = '/'.join(list(hash_init))
110 return hashed_path
111
112
113# for FIPS support

Callers 1

get_urlsFunction · 0.85

Calls 3

get_podname_properFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected