Created
April 11, 2016 07:51
-
-
Save Brick85/60c668c31e09aedce58b994275e01e93 to your computer and use it in GitHub Desktop.
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
# http://stackoverflow.com/questions/21986602/fixed-length-int-obfuscator-does-anyone-know-how-to-do-this | |
class IntObfuscator(object): | |
m = 1000000000 | |
x = 387420489 | |
inverseX = 513180409 | |
def encode_int(self, value): | |
return value * self.x % self.m | |
def decode_int(self, encoded): | |
return encoded * self.inverseX % self.m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment