Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use md5 hash as disk cache filename if key is too long #15

Closed
hpique opened this issue Jul 24, 2014 · 10 comments
Closed

Use md5 hash as disk cache filename if key is too long #15

hpique opened this issue Jul 24, 2014 · 10 comments

Comments

@hpique
Copy link
Member

hpique commented Jul 24, 2014

No description provided.

@hpique hpique added this to the Disk image cache milestone Jul 24, 2014
@hpique hpique self-assigned this Jul 24, 2014
@hpique hpique removed their assignment Aug 8, 2014
@hpique hpique self-assigned this Aug 11, 2014
@hpique
Copy link
Member Author

hpique commented Aug 12, 2014

This is turning out to be really difficult. The implementation is done, but with a nasty hack involving module maps to include CommonCrypto, which is what I use to calculate the MD5.

I'm considering either waiting until Swift has a MD5 function, or using a simpler hashing method.

@hpique
Copy link
Member Author

hpique commented Aug 12, 2014

Maybe Fowler–Noll–Vo.

@Lascorbe
Copy link
Member

@hpique
Copy link
Member Author

hpique commented Aug 12, 2014

Yeah, something like that is what I used initially. The problem is using the C library CommonCrypto in a Swift framework.

FNV can be implemented without external dependencies.

@Lascorbe
Copy link
Member

Oh, I didn't realize he's using CommonCrypto there, sorry. Yeah, then FNV could be the solution 😄

@hpique
Copy link
Member Author

hpique commented Aug 26, 2014

Work in progress in this branch.

I'm freeing this issue for now. Might return to it later (Beta 7?).

@hpique hpique removed their assignment Aug 26, 2014
@joanromano
Copy link
Member

What's the status on this? Probably we could check this out https://github.com/krzyzanowskim/CryptoSwift/blob/master/CryptoSwift/MD5.swift

@hpique
Copy link
Member Author

hpique commented Sep 15, 2014

I was waiting for Apple to add the CommonCrypto module, but we can also use this (assuming it actually works). Nice find!

@madninja
Copy link

murmur hash might be a good solution for this. https://github.com/jwerle/murmurhash.c is an example of this and there are 64 bit versions of this as well, all of them CommonCrypto free

@hpique
Copy link
Member Author

hpique commented Oct 15, 2014

Thanks @madninja. I decided to use CryptoSwift as I'm more familiar with MD5.

@hpique hpique closed this as completed in 2e8f69f Oct 15, 2014
hpique added a commit that referenced this issue Oct 15, 2014
Use md5 hash as disk cache filename if key is too long. Closes #15.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants