Open takeru opened 1 year ago
An asset dictionary represents an Asset field type with the following keys:
sample_photos = []
for _photo in api.photos.all:
sample_photos.append(_photo)
if 10<=len(sample_photos):
break
import base64
for index, photo in enumerate(sample_photos):
# print(json.dumps(photo._master_record,indent=2))
print(f"[{index}]")
fileChecksum = photo._master_record["fields"]["resOriginalRes"]["value"]["fileChecksum"]
downloadURL = photo._master_record["fields"]["resOriginalRes"]["value"]["downloadURL"]
print("curl -o '%s_%s' '%s'" % (fileChecksum.replace("+","-").replace("/","_"), photo.filename, downloadURL))
b64 = fileChecksum
print(b64)
bin = base64.b64decode(b64)
print(bin)
hx = bin.hex()
print(hx)
print(len(hx))
print("")
When I decode base64 to hex, the first byte seems to be fixed at 01. Is this a version of the hash algorithm? Is it something like 20byte = 160bit algorithm?
sample_photos = [] for _photo in api.photos.all: sample_photos.append(_photo) if 10<=len(sample_photos): break import base64 for index, photo in enumerate(sample_photos): # print(json.dumps(photo._master_record,indent=2)) print(f"[{index}]") fileChecksum = photo._master_record["fields"]["resOriginalRes"]["value"]["fileChecksum"] downloadURL = photo._master_record["fields"]["resOriginalRes"]["value"]["downloadURL"] print("curl -o '%s_%s' '%s'" % (fileChecksum.replace("+","-").replace("/","_"), photo.filename, downloadURL)) b64 = fileChecksum print(b64) bin = base64.b64decode(b64) print(bin) hx = bin.hex() print(hx) print(len(hx)) print("")
When I decode base64 to hex, the first byte seems to be fixed at 01. Is this a version of the hash algorithm? Is it something like 20byte = 160bit algorithm?
It seems the algorithm is not a public algorithm. You should only use the checksum but can not calculate it.
The problem
value = photo._master_record["fields"]["resOriginalRes"]["value"]
In the value to 'fileChecksum' 'wrappingKey' 'referenceChecksum' What is the meaning of these hash values? I want to check the checksum of a downloaded file. I wish I knew the algorithm and encoding, but does anyone know?
Environment
pip show pyicloud
): 1.0.0python -V
): Python 3.10.8Traceback/Error logs
Checklist
Additional information