The AssetBundleManifest uses Hash128. But the only other functions that use this hash relate to the asset bundle cacheing system, which seems very limited (no way to check if a bundle is cached by name+hash, in particular)
So it looks like it’s probably necessary to avoid this caching system if you want control over when bundles are downloaded. But if I do this, then I need to be able to compute a Hash128 of bundles that I download, so I can check their integrity/version against the manifest
Are there any functions for computing this Hash128 from a file or byte array at runtime? - the Hash128 class itself appears just to be a container for a hash
What hashing alrorithm does it use? Is it MD5 (probably not), or SHA-1? My guess would be SHA-1. Try computing a SHA1 hash and see if it matches.
From this post:
http://aras-p.info/blog/2016/08/02/Hash-Functions-all-the-way-down/ , It sounds like it’s using Spooky-v2: http://burtleburtle.net/bob/hash/spooky.html - although I’ve not tested that that code generates matching hashes
Kind of hoping that there’s a better option than trying to convert that to C# ( ‘The C++ reference implementation is specific to 64-bit x86 platforms, in particular it assumes the processor is little endian’ ). Is there any way to add data to the manifest bundle?..
Was really hoping that the hashing functionality would be exposed, as without it, the usefulness of the AssetBundleManifest seems quite limited?
Luckily someone has already done it for you 
https://bitbucket.org/JonHanna/spookilysharp
Ah, I’d had a quick google but not found anything - Looks like the license may unsuitable there, though (GPL-like) 
Hmmm, are big-endian Android devices still a thing, or is it relatively safe to assume that everything is little-endian these days?
Ahh, you need to use this in a running app? If Endianness is a problem, just run an Array.Reverse() before running through the algorithm.
Anyhow, here’s another implementation… it’s a full hashing library with lots of implementations but SpookyHash is included and it’s MIT licensed:
https://github.com/brandondahler/Data.HashFunction/
1 Like
Yeah, I’m looking for a way to compute the hash of a downloaded assetbundle, so I can compare it against the hash in the manifest bundle - without using the built-in assetbundle caching system, as that looks rather limited
1 Like
Turns out that there is actually a Caching.IsVersionCached( string, Hash128 ), it’s just missing from the docs. So I can probably just use the built-in cache, as that was the main thing I seemed to be missing
1 Like
i dont understand, what is the point of using the cache system if you have to download the file and check the hash128 against the manifest. You already download the file anyways, or am I missing something. From what I am seeing you are downloading the file whether or not the hash128 matches to check the hash128…
I wanted to use the hashes from the manifest bundle with my own downloading/caching system. But that didn’t seem possible/practical - seems to be ‘all or nothing’ - if you don’t use the caching system, you can’t make use of the hashes?