LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Apple has seemed to find new ways to obfuscate code (https://www.linuxquestions.org/questions/programming-9/apple-has-seemed-to-find-new-ways-to-obfuscate-code-4175607951/)

Laserbeak 06-15-2017 03:46 AM

Apple has seemed to find new ways to obfuscate code
 
Code:

    for (NSDecimalNumber *myNumber = [NSDecimalNumber decimalNumberWithMantissa:0 exponent:1 isNegative:NO]; myNumber.doubleValue < 32; myNumber = [myNumber decimalNumberByAdding:[NSDecimalNumber decimalNumberWithMantissa: 1 exponent: 0 isNegative:NO]]) {
       
        NSLog(@"%@", [myNumber decimalNumberByRaisingToPower: 3]);
    }

This prints 0 to 31 each to the 3rd power.

wpeckham 06-15-2017 07:30 AM

Was there some question or new observation in that?

frieza 06-15-2017 10:15 AM

obfuscated? that doesn't look obfuscated to me

Code:

<?php
$code='Zm9yICh4ID0gMSB0byAxMCkgew0KCXByaW50KHgpDQp9';
eval(base64_decode($code));
?>

is obfuscated code (php)

GazL 06-15-2017 10:41 AM

Quote:

Originally Posted by Laserbeak (Post 5722920)
Code:

    for (NSDecimalNumber *myNumber = [NSDecimalNumber decimalNumberWithMantissa:0 exponent:1 isNegative:NO]; myNumber.doubleValue < 32; myNumber = [myNumber decimalNumberByAdding:[NSDecimalNumber decimalNumberWithMantissa: 1 exponent: 0 isNegative:NO]]) {
       
        NSLog(@"%@", [myNumber decimalNumberByRaisingToPower: 3]);
    }

This prints 0 to 31 each to the 3rd power.

And people complained that COBOL was long-winded. :)

wpeckham 06-15-2017 10:46 AM

Quote:

Originally Posted by GazL (Post 5723041)
And people complained that COBOL was long-winded. :)

Only by convention. But then, it was created by the Navy, for the Navy, so it had to be.

Ever LISP?

GazL 06-15-2017 10:54 AM

Quote:

Originally Posted by wpeckham (Post 5723044)
Ever LISP?

Not in anger. :) I toyed with emacs lisp just enough to get a feel for it, but little more than that.

sundialsvcs 06-15-2017 12:43 PM

Code:

identification division.
program-id. the-navy.
[...]
procedure division.
sail-the-seven-seas.
      perform government-contract
          varying budget 1000000000 by 1000000000 until hell-freezes-over.
      go to sail-the-seven-seas.

Seriously, Apple's "objective-C" code is quite incomprehensible. I think that their new "Swift" language will supersede it.

Laserbeak 06-15-2017 04:51 PM

Of course you can do it much easier, but by using NSDecimalNumber, you have a theoretically unbounded variable, so you don't have to worry about overflows, no matter how big your number gets.

But in reality, everything is eventually bounded, the max number given is 3.402823669209387e+165.


All times are GMT -5. The time now is 03:38 AM.