Skip to content

Conversation

lericson
Copy link

@lericson lericson commented Jul 7, 2014

Previously all random data came from Python’s built-in UUID4 encoded in
hexadecimal. Hexadecimal encodes 16 values in one byte, that means there
is a 4:8 ratio of meaningful bits to each byte of hexadecimal encoding.
Instead we use base64 which encodes at a 6:8 ratio. This has the added
benefit of looking better.

Previously all random data came from Python’s built-in UUID4 encoded in
hexadecimal. Hexadecimal encodes 16 values in one byte, that means there
is a 4:8 ratio of meaningful bits to each byte of hexadecimal encoding.
Instead we use base64 which encodes at a 6:8 ratio. This has the added
benefit of not looking amateurish.
@lericson
Copy link
Author

lericson commented Jul 7, 2014

Also it should be 90% backward-compatible.

@lericson
Copy link
Author

lericson commented Jul 7, 2014

All new API keys will have the larger hash space and more expressive encoding; all old ones will still work. I haven't tried migrating a UUID field in PostgreSQL and would suspect that the conversion isn't painless. What happens in psql if you alter a column type from uuid to varchar? Will it simply be hexadecimal?

@lericson
Copy link
Author

Reworded the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant