Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Play with numbers

by Anonymous Monk
on Jul 04, 2009 at 16:55 UTC ( #777259=obfuscated: print w/replies, xml ) Need Help??

An script I wrote, which outputs Japh. It decrypts $x by multiplying 2 integers and the act like it is a binary number. The code isn't really exciting, but the way I encoded 'Japh' is kinda interesting.
$x = '3336703366667337000033670003' ;$d=sub {chr unpack('N',pack ( 'B32',substr(('0'x32).((shift) * (shift)),-32) )) ;};print ${ dx( $d, $x) }; sub dx{ while ( $_[1]=~/(\d{6})(\d{1})/g){$out .= &{ $_[0]}($1 ,$2); }\$out;}

Replies are listed 'Best First'.
Re: Play with numbers
by Daniel Mantovani (Novice) on Jul 06, 2009 at 03:13 UTC

    My output is "CooL".

    $x = '3333373367037336703733337003' ;$d=sub {chr unpack('N',pack ( 'B32',substr(('0'x32).((shift) * (shift)),-32) )) ;};print ${ dx( $d, $x) }; sub dx{ while ( $_[1]=~/(\d{6})(\d{1})/g){$out .= &{ $_[0]}($1 ,$2); }\$out;}

    First, convert the number to binary. Treat the converted number as an integer (base 10) and divide by 3:

    C = 1000011 / 3 = 333337

    Now get the result and concatenate with 3:

    333337 . 3 = 3333373

    $x = '3333373' ;$d=sub {chr unpack('N',pack ( 'B32',substr(('0'x32).((shift) * (shift)),-32) )) ;};print ${ dx( $d, $x) }; sub dx{ while ( $_[1]=~/(\d{6})(\d{1})/g){$out .= &{ $_[0]}($1 ,$2); }\$out;}

    Now the output is "C", just keep concatenating numbers to $x to form your wanted sentence!

    Letters Possibles
    C:1000011:333337
    E:1000101:333367
    F:1000110:333370
    I:1001001:333667
    J:1001010:333670
    L:1001100:333700
    Q:1010001:336667
    R:1010010:336670
    T:1010100:336700
    X:1011000:337000
    a:1100001:366667
    b:1100010:366670
    d:1100100:366700
    h:1101000:367000
    o:1101111:367037
    p:1110000:370000
    w:1110111:370037
      With a different divisor than 3 different character sets are possible. 1 is a reference set.
      1 => abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*( +))_+1234567890,.?; 3 => abdhopwCEFIJLQRTX#%&*))_1248,? 7 => alsGHTZ$*6? 21 => aT*? 2 => bdfhjlnprtvxzBDFHJLNPRTVXZ @$^&*(24680,. 5 => bdfhjlnprtvxzBDFHJLNPRTVXZ @$^&*(24680,. 6 => bdhpFJLRTX&*248, 10 => bdfhjlnprtvxzBDFHJLNPRTVXZ @$^&*(24680,. 15 => bdhpFJLRTX&*248, 30 => bdhpFJLRTX&*248, 37 => bpwFT#*18? 74 => bpFT*8

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://777259]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2020-12-04 02:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (58 votes). Check out past polls.

    Notices?