Created
April 24, 2019 18:14
-
-
Save patrickfav/925a617862cdb6f246b7c334aeb81270 to your computer and use it in GitHub Desktop.
Id Mask 64-Bit Integer Example for Medium Article
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
byte[] key = Bytes.random(16).array(); | |
long id = ... | |
IdMask<Long> idMask = IdMasks.forLongIds(Config.builder(key).build()); | |
String maskedId = idMask.mask(id); | |
//example: NPSBolhMyabUBdTyanrbqT8 | |
long originalId = idMask.unmask(maskedId); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment