-
Notifications
You must be signed in to change notification settings - Fork 476
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
Add binary representation of hash-size #399
Conversation
Sorry, I don't quite understand. What will this be used for? |
It was just trying to show clearly (in code), what was mentioned in passing in the comments. Also split it up into smaller patches for delivery, and found the alignment issue by accident... |
Still not sure if I understand. Do you want me to merge this?
Which issue is that? |
It can wait, there is nothing in the current code that is using it. It's going to be more interesting when the storage API is up
Clang complained, when writing an integer to a byte array... So changed the definition of the type, from 20 x 1 to 5 x 4 :
|
As per discussion in #404, one interesting variation could be an improved text representation... If we do still need a string format, for instance for a file-based storage, we could try something new. This extends the So instead of The main reason to use plain old hexadecimal is for portability and accessability. But if not needed ? |
Did you mean (backward) compatibility with "portability"? If so: Before we can discuss a replacement of the text representation, I think that we first need to come to a consensus regarding whether it is OK to break compatibility with old versions or not since changing the default backend's first-level storage directory names breaks compatibility. My current view on this is described in #416 (comment). |
Not necessarily. I meant that hexadecimal is available everywhere, like in hexdump or in *sum commands or openssl. Then again the binary keys (i.e. full 8-bit range) aren't really easy to work with (without a tool) either. Will comment in #416 |
I removed the base32hex function, it's not really needed if the keys are indeed binary. |
Fixed size efficient binary representation data, instead of the variable size hexadecimal string. This is suitable for machine use, while the other is more suitable for human readability as string.
Make sure that output is NUL-terminated
Thanks! |
* Add binary representation of hash-size Fixed size efficient binary representation data, instead of the variable size hexadecimal string. This is suitable for machine use, while the other is more suitable for human readability as string. * Promote hex format as a global function * Add unittest for the format_hex function Make sure that output is NUL-terminated
Fixed size efficient binary representation data, instead of the variable size hexadecimal string:
This is suitable for machine use, while the other is more suitable for human readability as string:
As discussed in #218
Can be used as key, when not needed as filename. Data structure is aligned and avoids allocation.