Example #1
0
        private static void ObfuscateDoubleValue(ref DetectedAttributeValue targetDV, ref Random random)
        {
            double confidence = targetDV.stdDev;
            double dblVal     = ((DoubleValue)((DetectedAttributeValue)targetDV).value).value;
            double X          = random.NextDouble();
            double Y          = .5 - (X / 2);
            double Z          = ZTransformer.ZTransformGivenProbability(Y);

            //double area = (double)(random.Next((int)(Z * 10), (int)(Z * -10)) / 10.0);


            //obfuscate int
            ((DoubleValue)((DetectedAttributeValue)targetDV).value).value = (double)(Z * confidence + dblVal);
            //exit
            targetDV.stdDev = GetConfidence(Y) * 100;
        }
Example #2
0
        private static void ObfuscateLocationValue(ref DetectedAttributeValue targetDV, ref Random random)
        {
            double confidence = targetDV.stdDev;
            double x          = ((LocationValue)((DetectedAttributeValue)targetDV).value).X;
            double y          = ((LocationValue)((DetectedAttributeValue)targetDV).value).Y;
            double z          = ((LocationValue)((DetectedAttributeValue)targetDV).value).Z;
            double X          = random.NextDouble();
            double Y          = .5 - (X / 2);
            double Z          = ZTransformer.ZTransformGivenProbability(Y);

            //obfuscate X
            ((LocationValue)((DetectedAttributeValue)targetDV).value).X = (double)(Z * confidence + x);
            //obfuscate Y
            ((LocationValue)((DetectedAttributeValue)targetDV).value).Y = (double)(Z * confidence + y);
            //obfuscate Z
            ((LocationValue)((DetectedAttributeValue)targetDV).value).Z = (double)(Z * confidence + z);
            //exit
            targetDV.stdDev = GetConfidence(Y) * 100;
        }
Example #3
0
        private static void ObfuscateVelocityValue(ref DetectedAttributeValue targetDV, ref Random random)
        {
            double confidence = targetDV.stdDev;
            double vx         = ((VelocityValue)((DetectedAttributeValue)targetDV).value).VX;
            double vy         = ((VelocityValue)((DetectedAttributeValue)targetDV).value).VY;
            double vz         = ((VelocityValue)((DetectedAttributeValue)targetDV).value).VZ;
            double X          = random.NextDouble();
            double Y          = .5 - (X / 2);
            double Z          = ZTransformer.ZTransformGivenProbability(Y);

            //double area = (double)(random.Next((int)(Z * 10), (int)(Z * -10)) / 10.0);

            //obfuscate VX
            ((VelocityValue)((DetectedAttributeValue)targetDV).value).VX = (double)(Z * confidence + vx);
            //obfuscate VY
            ((VelocityValue)((DetectedAttributeValue)targetDV).value).VY = (double)(Z * confidence + vy);
            //obfuscate VZ
            ((VelocityValue)((DetectedAttributeValue)targetDV).value).VZ = (double)(Z * confidence + vz);
            //exit
            targetDV.stdDev = GetConfidence(Y) * 100;
        }
Example #4
0
        private static void ObfuscateStringValue(ref DetectedAttributeValue targetDV, ref Random random)
        {
            double confidence = targetDV.stdDev;
            string strVal     = ((StringValue)((DetectedAttributeValue)targetDV).value).value;
            double X          = random.NextDouble();
            double Y          = .5 - (X / 2);
            double Z          = ZTransformer.ZTransformGivenProbability(Y);
            int    strLen     = strVal.Length;

            strLen = (int)Math.Round((Z * confidence) + strLen, 0);
            char[] str;
            if (strLen <= strVal.Length)
            {
                str = strVal.ToCharArray(0, strLen);
            }
            else
            {
                for (int b = strVal.Length; b < strLen; b++)
                {
                    strVal += Convert.ToChar(random.Next(49, 122));
                }
                str = strVal.ToCharArray();
            }
            StringBuilder sb = new StringBuilder();

            for (int a = 0; a < strLen; a++)
            {
                int asciiVal = Convert.ToInt32(str[a]);
                asciiVal = (int)Math.Round((ZTransformer.ZTransformGivenProbability(.5 - (random.NextDouble() / 2)) * confidence) + asciiVal, 0);
                //str[a] = Convert.ToChar(asciiVal);
                sb.Append(Convert.ToChar(asciiVal));
            }
            //((StringValue)((DetectedAttributeValue)targetDV).attribute).value = str.ToString();
            ((StringValue)((DetectedAttributeValue)targetDV).value).value = sb.ToString();
            targetDV.stdDev = GetConfidence(Y) * 100;
        }