Eve Online, a game I used to play, had an interesting "permissions" system for account interactions with other apps.

The permissions encompassed dozens of individual permissions, each under a category (which may or may not have been relevant to the resulting hash)

The interesting thing is that the entire permission state of the account could be saved as one resulting string, or hash, which translated in turn, back to a detailed set of individual permissions.

What algorithm or system is responsible for such an ingenious and compressed way of signifying permissions?

  • 2
    If it can be translated back, then, by definition, this cannot be a hash. – 5gon12eder Mar 26 '16 at 22:27
  • 1
    @5gon12eder: It's likely it merely has the characteristic "wall-of-unintelligible-but-readable-characters" appearance that formatted hashes have. (As well as GUIDs and all manner of other essentially binary data formats.) But clarifying that would be handy. – Nathan Tuggy Mar 26 '16 at 23:22
up vote 6 down vote accepted

Assuming the permissions were binary and that the set of permissions was predetermined and rarely changed, a bitfield would be a good starting point. Pair each bitfield (with a fixed length) with an identifier for the app (also of fixed length, perhaps a GUID) and you've got a simple record type that can then be repeated for each app. Then just convert that into Base64 or some similar way to encode pure binary in readable text and you're done.

Specifically, a bitfield uses a single bit for each boolean value, masking off bits within bytes (or words) with efficient bitwise operators in order to set or read those bits. This combines efficient memory usage with fast operators at the expense of somewhat awkward manipulation.

This can be done using object serialization and deserialization.

Serialization converts all of the relevant properties to some storage mechanism (maybe a file).

Deserialization is the opposite process, converting the stored object back into an object.

Compression and encryption can be further added to the de/serialization process to both reduce the size of the stored object and make it more difficult to determine the contents.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.