Skip to content

Instantly share code, notes, and snippets.

@trzecieu
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trzecieu/f422f8f63fd3d69a5432 to your computer and use it in GitHub Desktop.
Save trzecieu/f422f8f63fd3d69a5432 to your computer and use it in GitHub Desktop.
package pl.asria.tools.data.secure {
public class sInt
{
protected var _lifespan:int;
protected var _counter:int;
protected var _value:int;
protected var _lock:int;
public function sIntR(val:int = 0, lifespan:int = 16)
{
_lifespan = lifespan;
_counter = _lifespan;
_lock = Math.random() * int.MAX_VALUE;
value = val;
}
public function get value():int
{
return _lock ^ _value;
}
public function set value(value:int):void
{
if (--_counter == 0)
{
_lock = Math.random();
_counter = _lifespan;
}
_value = value ^ _lock;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment