Just Another Perl Hacker

28 June 2022

I’ll be working with perl starting from next week so I spent yesterday learning it. Today is day two and I came up with the following.

use feature qw(say);

*SHIFT=sub{return sub{my$shift=shift;sub{
$shift}}if not(1-shift);sub{sub{shift}};}
;*SUB=sub{my$shift=shift;return$shift/(
SUBSHIFT->(SUBSHIFT(0)))if not$shift %
SUBSHIFT->(SHIFT->(0)->(0)->(SUBSHIFT->(0)
));SUBSHIFT->(SUBSHIFT->(SUBSHIFT->(SHIFT->
(0)->(0)->(SUBSHIFT->(0))))*$shift);}
;*SUBSHIFT=sub{int(int(shift)+1);};
*SHIFTSUB=sub{my($shift,$SHIFT)=(shift,
shift);SHIFT->($shift)->(sub{$SHIFT})->(
sub{SHIFTSUB->(SUB->($shift),SUBSHIFT->(
$SHIFT))})->();};*SHIFTSUBSHIFT=sub{
SHIFTSUB->(int(shift),0)};say join"",
map{chr}map{SHIFTSUBSHIFT->()}(
18889465931478580854784,
36893488147419103232,
1208925819614629174706176,
4722366482869645213696);

Here’s a more deobfuscated version

use feature qw(say);

*SHIFT = sub {
    return sub { my $shift = shift; sub { $shift} } if not (1 - shift);
    sub { sub { shift } };
};

*SUB  = sub {
    my $shift = shift;
    return $shift / (SUBSHIFT->(SUBSHIFT(0))) if not $shift % SUBSHIFT->(SHIFT->(0)->(0)->(SUBSHIFT->(0)));
    SUBSHIFT->(SUBSHIFT->(SUBSHIFT->(SHIFT->(0)->(0)->(SUBSHIFT->(0)))) * $shift);
};

*SUBSHIFT = sub {
    int (int(shift) + 1);
};

*SHIFTSUB = sub {
    my ($shift, $SHIFT) = (shift, shift);
    SHIFT->($shift)->(
        sub { $SHIFT}
    )->(
        sub { SHIFTSUB->(SUB->($shift), SUBSHIFT->($SHIFT)) }
    )->();
};

*SHIFTSUBSHIFT = sub {
    SHIFTSUB->(int(shift), 0)
};

say join "", map { chr } map { SHIFTSUBSHIFT->() } (18889465931478580854784, 36893488147419103232, 1208925819614629174706176, 4722366482869645213696);