Board Logo
« Hiding in plain sight »

Welcome Guest. Please Login or Register.
Jan 16th, 2018, 3:39pm


Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Please use the forums Search feature before asking.
Please post code using the code box described in Format Your Messages.
This will keep indentation, separate it better form the message and prevent gibberish.
If the code is too long for one post or additional files are needed, upload a ZIP archive to the Just BASIC Files Archive Site.

« Previous Topic | Next Topic »
Pages: 1 2  Notify Send Topic Print
 veryhotthread  Author  Topic: Hiding in plain sight  (Read 801 times)
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1255
xx Re: Hiding in plain sight
« Reply #15 on: Jul 19th, 2017, 9:37pm »

Here it is, 16 ways to unwind a spiral matrix!

Code:
'From spiral text block to straight text string.txt for JB (B+=MGA) 2017-07-19
' Major modifying tsh73 code for 16 variations on straightening out a Spiral Matrix

global N

'PLUG in Spiral Matrix N x N

'data "abc"
'data "hid"
'data "gfe"
'N = 3

'data "abcd"
'data "lmne"
'data "kpof"
'data "jihg"
'N = 4

' My first post test
' From or To corner: (15, 1)
' CLOCKWISE SPIRAL Inside Out:
'data "?              "
'data "sG IN PLAIN SIG"
'data "iNa dream abouH"
'data "hI of hiding tT"
'data "tDd John T ts  "
'data " Iat threadotdC"
'data "oHhcd  Bas uuoa"
'data "d  engeInibcfin"
'data " !Ijanht cohfn "
'data "os b idoc te ga"
'data "ti.u37hst hdi n"
'data " hts eht no nsy"
'data "ethgis nialp oo"
'data "d ekil gnihtemn"
'data "oc etirw esle e"
'N = 15

' tsh73 Mouse sad tale
' From or To corner: (15, 15))
' CLOCKWISE SPIRAL Outside In:
data "ne is a long an"
data "ig to Alice, ad"
data "Mn certainly,n "
data "'i,n with wo'da"
data " nlw tail; n   "
data " riosou ca'dsss"
data " uad'yad?lbeaia"
data " tt e s 'lurigd"
data "   gso ti t dh "
data " ,gnud yhw a it"
data " enioM eht tAna"
data " sokool ,ecilgl"
data " ul a si tI' .e"
data " oM eht dias '!"
data "               " '<<< added line and spaces for N squared characters
N = 15

'Note I thought about John's but my eyes aren't that great to translate a
'snapshot into text.

'====================================================== end Plug-in Section

cs$ = "CLOCKWISE SPIRAL "
ccs$ = "COUNTER-";cs$
maxLimit = N * N

'directions from top left corner: left > down > right > up = clockwise
dim dx(3), dy(3)
for i = 0 to 3   'from 0 to use MOD
    dx(i)=val(word$("1 0 -1 0", i + 1))
    dy(i)=val(word$("0 1 0 -1", i + 1))
next

dim corners(3, 1)
for i = 0 to 3
    corners(i, 0) = val(mid$("0110", i + 1, 1)) * (N-1)
    corners(i, 1) = val(mid$("0011", i + 1, 1)) * (N-1)
    'print "corner ";corners(i, 0);", ";corners(i, 1)
next

'read data into c$ for characters
dim cs$(N, N)
for j = 1 to N
    read a$
    for i = 1 to N
        cs$(i, j) = mid$(a$, i, 1)
    next
next

for clock = 1 to 2
    if clock = 2 then 'counter clockwise for outside in
        for i = 0 to 3
            dx(i)=val(word$("0 1 0 -1", i + 1))
            dy(i)=val(word$("1 0 -1 0", i + 1))
        next
    end if
    for crnr = 0 to 3  'start our gathering at a corner
        if clock = 1 then title$ = cs$ else title$ = ccs$
        x = corners(crnr, 0) + 1  'plus 1 to align with string array
        y = corners(crnr, 1) + 1
        if clock = 1 then
            dirIndex = crnr
        else
            'if crnr = 0 then dirIndex = 0
            'if crnr = 1 then dirIndex = 3
            'if crnr = 2 then dirIndex = 2
            'if crnr = 3 then dirIndex = 1
            dirIndex = (4 - crnr) mod 4
        end if
        call showMatrix
        print "From or To corner: (";x;", ";y;")"
        maxL = N
        ll = 1
        tl = 0
        b$ = ""
        Print title$;"Outside In:"
        while 1
            SCAN
            'print x, y, c$, ll
            c$ = cs$(x,y)
            print c$;
            b$ = b$;c$
            ll = ll + 1
            if ll > maxL then
                dirIndex = (dirIndex + 1) mod 4
                ll = 1
                maxL = maxL - .5
            end if
            tl = tl + 1
            if tl >= maxLimit then 'finsih off this loop
                ' Inside out is just the reverse of Outside In
                ' and reverse of clock direction
                print
                if clock = 1 then title$ = ccs$ else title$ = cs$
                rb$ = reverse$(b$)
                print : print title$;"Inside Out:"
                for i = 1 to len(rb$)
                    print mid$(rb$, i, 1);
                    if i mod 64 = 0 then print
                next
                print: print: print
                exit while
            end if
            if tl mod 64 = 0 then print
            x = x + dx(dirIndex)
            y = y + dy(dirIndex)
        wend
    next
next

function reverse$(s$)
    if len(s$)= 1 then reverse$ = s$ else reverse$ = reverse$(mid$(s$,2));left$(s$, 1)
end function

sub showMatrix
    for j = 1 to N
        for i = 1 to N
            print cs$(i,j);
        next
        print
    next
    print
end sub

 
User IP Logged

B+
tsh73
JB-Supporter


member is offline

Avatar




PM

Gender: Male
Posts: 3635
xx Re: Hiding in plain sight
« Reply #16 on: Jul 20th, 2017, 01:17am »

Very very funny texts it produces.
Like

Quote:
but the Mouse'sou call why do yad?
all why do you c?
It is a king down with wonder atice, looouse's tail;
the Mouse's with wonder at ice, looking downcertainly,' said Al
turninge is a long and a sad tale!

Strange but I expect outside clockwise from (1, 15) be correct. Program shows correct text from (15, 15).
I see. The text was too short to fill the matrix, so empty line was added below.
« Last Edit: Jul 20th, 2017, 01:20am by tsh73 » User IP Logged

Q: "And if I took your codes and compile them, and sell them for a profit"?
A: Go ahead. I had my share of good then I coded it for fun, if you can make better use of it - please do.
(enjoying JB 1.01 on WinXP, netbook and desktop)
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1255
xx Re: Hiding in plain sight
« Reply #17 on: Jul 20th, 2017, 01:49am »

Hey I got to reproduce John's message too!

I built a Custom Design Spiral Matrix Message program:
Code:
' Custom Design Spiral Matrix Message.txt for JB (B+=MGA) 2017-07-20
' Modifying
' From spiral text block to straight text string.txt 2017-07-19
' And code from tsh73, JB forum thread Hiding in Plain Sight, reply #1 2017-07-17

' Answer 3 questions and then plug-in your message

outsideIn = 0   ' 1 for true, the message starts on outside corner and spirals inward
                '0 for false, the message starts on the inside and spirals out to corner

clockwise = 0   ' 1 for true, the message will go around clockwise
                ' 0 for false, the message will go around Counter clockwise

corner = 0      ' 0 for top left corner to start or end the message string
                ' 1 for top right corner to start or end the message string
                ' 2 for bottom right corner to start or end the message string
                ' 3 for bottom left corner to start or end the message string

'Now for the message to spiral into a block of letters

'm$ = "This is a sample message for testing custom designed spiral matrix wrapping."
'm$ = "123456789"
m$ = "It is great having an online community like this one. I sure think so. Let me just "
m$ = m$;"suggest a couple of ways to make (and keep) it really great. First - search the "
m$ = m$;"forum. Your question might already have been answered. If not, do not hesitate "
m$ = m$;"to ask. We do not bite. Second - be polite. Everyone here is a volunteer. None "
m$ = m$;"of us gets paid to do this stuff. It just makes it so much more fun when we are "
m$ = m$;"all nice to each other. Remember what your mom said: If you cannot say anything "
m$ = m$;"nice, say nothing."
L = len(m$)
Global N
if int(sqr(L)) = sqr(L) then N = sqr(L) else N = int(sqr(L)) + 1
buff$ = space$(N*N - L)

'lets put the buffer at the end of the message so it is N * N characters long
m$ = buff$;m$ '<<< switched for John's so hole will be in middle

'set corner to start
x = val(mid$("0110", corner + 1, 1)) * (N-1)
y = val(mid$("0011", corner + 1, 1)) * (N-1)

dim dx(4), dy(4) 'ready the direction arrays

if outsideIn = 0 then
    if clockwise then clockwise = 0 else clockwise = 1
    m$ = reverse$(m$)
end if

for i = 0 to 3
    if clockwise then
        dx(i)=val(word$("1 0 -1 0", i + 1))
        dy(i)=val(word$("0 1 0 -1", i + 1))
        dirIndex = corner
    else
        dx(i)=val(word$("0 1 0 -1", i + 1))
        dy(i)=val(word$("1 0 -1 0", i + 1))
        dirIndex = (4 - corner) mod 4
    end if
next

maxL = N
ll = 0
for i = 1 to N*N
    c$ = mid$(m$, i, 1)
    locate x+1, y+1: print c$;
    ll = ll+1
    if ll >= int(maxL) then
        dirIndex = (dirIndex + 1) mod 4
        ll = 0
        maxL = maxL - .5
    end if
    x = x + dx(dirIndex)
    y = y + dy(dirIndex)
    'call pause 300
next

sub pause mil
    t0=time$("ms")
    while time$("ms")-t0<mil
        scan
    wend
end sub

function reverse$(s$)
    if len(s$)= 1 then reverse$ = s$ else reverse$ = reverse$(mid$(s$,2));left$(s$, 1)
end function

 


Code:
.gnihton yas ,ecin gnih
ot ecin lla era ew neht
  steg su fo enoN .rewy
ep ton od eW .ksa ote n
aabdaerla thgim noi tna
ciiyerg yllaer ti tenu
hdt aa tseggus ts)stufy
  eht eno siht eupeal a
ot.a.c.a gnivahkjeutoes
to v o n       i eqivr
h SeFuI       tlek s ot
ede ip o      a m reamo
rocbrlsn      ey duh  n
. oeseul      rttno shn
 tnet riIt is gieaYtica
Rhdn oene communL( o uc
ei  -f think so.  .nem
ms-a  ways to makem r u
e  nsearch the foruoeoo
msbswered. If not, dhsy
bte polite. Everyone
euff. It just makes itf
r what your mom said: I

 


Plugged that into 16 ways and this comes up:
Code:
From or To corner: (1, 1)
CLOCKWISE SPIRAL Outside In:
.gnihton yas ,ecin gnihtyna yas tonnac uoy fI :dias mom ruoy tah
w rebmemeR .rehto hcae ot ecin lla era ew nehw nuf erom hcum os
ti sekam tsuj tI .ffuts siht od ot diap steg su fo enoN .reetnul
ov a si ereh enoyrevE .etilop eb - dnoceS .etib ton od eW .ksa o
t etatiseh ton od ,ton fI .derewsna neeb evah ydaerla thgim noit
seuq ruoY .murof eht hcraes - tsriF .taerg yllaer ti )peek dna(
ekam ot syaw fo elpuoc a tseggus tsuj em teL .os kniht erus I .e
no siht ekil ytinummoc enilno na gnivah taerg si tI


COUNTER-CLOCKWISE SPIRAL Inside Out:
                              It is great having an online commu
nity like this one. I sure think so. Let me just suggest a coupl
e of ways to make (and keep) it really great. First - search the
 forum. Your question might already have been answered. If not,
do not hesitate to ask. We do not bite. Second - be polite. Ever
yone here is a volunteer. None of us gets paid to do this stuff.
 It just makes it so much more fun when we are all nice to each
other. Remember what your mom said: If you cannot say anything n
ice, say nothing.

 


(busy JB night!)
« Last Edit: Jul 20th, 2017, 02:06am by bplus » User IP Logged

B+
tenochtitlanuk ( John F)
Full Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 430
xx Re: Hiding in plain sight
« Reply #18 on: Jul 20th, 2017, 2:16pm »

Have enjoyed these extensions of the spiral and other techniques.

It is easy to program another way to hide plain text /reveal it programmatically. Space the text out and fill the gaps with random letters, ideally with the frequencies typical of English.

Surprisingly, it is also easy to hide it in some 'ordinary' text. Forgive me if I use below a piece of text of historical importance to US citizens. It seems I made a few errors when typing it...! I'm sure my ex-colonial friends know the original by heart...

I've made it quite easy to find my subversive hidden message. Will post the code after someone 'out there' finds the messsage and PM's me on the forum..

Code:
The un animous  eclarat*on of t*e thirt*en Unit*d State* of
AmeIica,_-Wnen in t e Courst of humhn evente, it be omes neU
essary nor one ieople tt dissolee the pdlitical bands wKich
havi connecned themgwith andther, aod to asmume amo g the pw
wers ofethe ear h, the heparateaand equvl statien to wh ch t
he naws of oature a d of Nasure's Gtd entitae them,ta decene
 respecm to theeopinionn of mantind req ires thot they fhoul
d d clare the causeu which mmpel tham to thn separa ion._-Wr
 hold tiese trughs to bh self-etident, shat all.men are crea
tedIequal, shat the  are eniowed byttheir C eator wath certn
in unalyenable  ights, bhat amoeg thesetare Lift, Liberey an
d tre pursu t of Haipiness.n-That t  securetthese rhghts, Ge
vernmen s are iUstituteS among  en, deroving thrir just powe
rs Crom thehconsentiof the noverneda That w enever ony Formr
of Gove nment bRcomes dustructise of thsse endsi it is ahe R
igh? of the People Io alter or to adolish io, and tn instit'
te new tovernme t, layitg its fhundatioi on sucn princikles
and organizsng its oowers i. such f_rm, as -o them shall see
m most likely to effect their Safety and Happiness. Prudence
, indeed, will dictate that Governments long established sho
 
« Last Edit: Jul 20th, 2017, 2:21pm by tenochtitlanuk ( John F) » User IP Logged

Visit my LB/JB pages at http://www.diga.me.uk/index.html
I use XP and Ubuntu Linux on old machines!
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1255
xx Re: Hiding in plain sight
« Reply #19 on: Jul 21st, 2017, 3:46pm »

Hi John,

Drawing a blank as how to attack this problem.

Maybe I am thrown by the word "simple".

Do have an idea now, and yeah, pretty simple!

I will see if it works.
User IP Logged

B+
tsh73
JB-Supporter


member is offline

Avatar




PM

Gender: Male
Posts: 3635
xx Re: Hiding in plain sight
« Reply #20 on: Jul 23rd, 2017, 4:42pm »

I've got the message though I 'm not sure it is only one.
It starts with
Code:
In the United Kingdom 

and ends with
Code:
I don't think so. 
User IP Logged

Q: "And if I took your codes and compile them, and sell them for a profit"?
A: Go ahead. I had my share of good then I coded it for fun, if you can make better use of it - please do.
(enjoying JB 1.01 on WinXP, netbook and desktop)
tenochtitlanuk ( John F)
Full Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 430
xx Re: Hiding in plain sight
« Reply #21 on: Jul 23rd, 2017, 5:46pm »

Well done Anatoly!
I was surprised how effectively the text is 'hidden'. I guess the brain gets to follow and guess/fill in the words it sees and simply assumes the error letters are random.
User IP Logged

Visit my LB/JB pages at http://www.diga.me.uk/index.html
I use XP and Ubuntu Linux on old machines!
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1255
xx Re: Hiding in plain sight
« Reply #22 on: Jul 23rd, 2017, 10:06pm »

Code:


The un animous  eclarat*on of t*e thirt*en Unit*d State* of AmeIica,_-Wnen in t e Courst of humhn evente, it be omes neUessary nor one ieople tt 
The unanimous Declaration of the thirteen united States of America,   When in the Course of human events, it becomes necessary for one people to
          _              _           *           *          *     U     *           *             I     _-   n          _             t            h            e         _             U          n          i             t

dissolee the pdlitical bands wKich havi connecned themgwith andther, aod to asmume amo g the pw wers ofethe ear h, the heparateaand equvl statien to
dissolve the political bands which have connected them with another, and to assume among the powers of the earth, the separate and equal station to
          e          d                         K          i             n            g            d           o          m              _          w            e           _         h            a            v          e 

 wh ch t he naws of oature a d of Nasure's Gtd entitae them,ta decene  respecm to theeopinionn of mantind req ires thot they fhoul d d clare the causeu 
 which the Laws of Nature and of Nature's God entitle them, a decent respect to the opinions of mankind requires that they should    declare the causes
      _    _    n            o            _            s           t          a            t            e           m         e            n             t           _          o           f            _  _                       u

which mmpel tham to thn separa ion._-Wr  hold tiese trughs to bh self-etident, shat all.men are crea tedIequal, shat the  are eniowed byttheir C eator
which impel them to the separation.     We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator
          m           a            n            _     _-     r            i           g           h          t           s         .                     _    I          s           _            i              t          _

 wath certn in unalyenable  ights, bhat amoeg thesetare Lift, Liberey an d tre pursu t of Haipiness.n-That t  securetthese rhghts, Ge vernmen s are 
 with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness. That to secure these rights, Governments are
    a          n_         y           _           b            e           t            t          e    _     r            _          i             n           _            t           h          e _            _   

iUstituteS among  en, deroving thrir just powe rs Crom thehconsentiof the noverneda That w enever ony Formr of Gove nment bRcomes dustructise of 
instituted among Men, deriving their just powers from the consent of the governed,  That whenever any Form of Government becomes destructive of
 U          S             _            o           r                  _    C            h           i           n             a               _            o             r            _            R              u          s     

thsse endsi it is ahe R igh? of the People Io alter or to adolish io, and tn instit' te new tovernme t, layitg its fhundatioi on sucn princikles and organizsng
these ends, it is the Right  of the People to alter or to abolish it, and to institute new Government, laying its foundation on such principles and organizing
    s           i         a      _   ?                         I                      d           o         n          '             t               _         t          h             i           n           k                        s 

 its oowers i. such f_rm, as -o them shall see m most likely to effect their Safety and Happiness. Prudence , indeed, will dictate that Governments long
 its powers in such form, as to them shall seem most likely to effect their Safety and Happiness. Prudence, indeed, will dictate that Governments long
      o            .            _           -                         _                                                                                                                                        
 established sho  

 established should not be 



 



Sorry the ski ad makes it impossible to use the PM editor. :(

I had to do this by hand copy / pasting in editor.

I am very ready see the code to isolate your message John!
« Last Edit: Jul 23rd, 2017, 10:15pm by bplus » User IP Logged

B+
tsh73
JB-Supporter


member is offline

Avatar




PM

Gender: Male
Posts: 3635
xx Re: Hiding in plain sight
« Reply #23 on: Jul 24th, 2017, 01:17am »

Interesting I attempted to code just as B+ - got source text, wrapped it at 60 characters, spit out any difference
(had to re-align wrapped text several times)

But
what I finally got looked like this
Code:
                       *       *       *   U   *       *
   I    _- n               t       h       e,              U
       n       i       t       e       d               K
   i       n       g       d    ,  o       m               w
       e               h       a       v       e
   n       o               s       t       a       t       e
       m       e       n       t               o       f
                   u       m       a       n            _- r
       i       g       h       t       s       .
   I       s               i       t               a       n
       y               b       e       t       t       e
   r               i       n-              t       h       e
               U       S               o       r
   C       h       i       n       a               o       r
               R       u       s       s       i       a
   ?               I               d       o       n       '
       t               t       h       i       n       k
           s       o       .       _       -
 

The pattern is really visible after some lines
So we could decode by pattern instead
Code:
open "puzzle.txt" for input as #1
k=0
while not(eof(#1))
    k=k+1
    line input #1, a1$
    for i = 4+(k mod 2)*4 to 60 step 8
        print mid$(a1$,i,1);
    next
    print
wend
close #1
 
User IP Logged

Q: "And if I took your codes and compile them, and sell them for a profit"?
A: Go ahead. I had my share of good then I coded it for fun, if you can make better use of it - please do.
(enjoying JB 1.01 on WinXP, netbook and desktop)
tenochtitlanuk ( John F)
Full Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 430
xx Re: Hiding in plain sight
« Reply #24 on: Jul 24th, 2017, 05:53am »

Anatoly- very close to what I used-
Code:
    open "outfile.jhf" for input as #fIn

    n =1

    do
        i$ =input$( #fIn, 1)
        if i$ <>chr$( 10) and i$ <>chr$( 13) then
            if n mod 8 =0 then print i$;
        end if
        n =n +1
    loop until eof( #fIn) =-1

    close #fIn

    end
 


bplus- I caught you by 'obfuscation'. That's partly why I used a well-known bit of text. But I could have used instead a personal letter telling readers what I and my family have been up to. Essentially I was mixing two texts in ratio 8 to 1. The asterisks'*' were put in to give a clue that something was repeating.

Fun- if I had any secrets I now have several ways to message almost un-noticeably!
User IP Logged

Visit my LB/JB pages at http://www.diga.me.uk/index.html
I use XP and Ubuntu Linux on old machines!
tsh73
JB-Supporter


member is offline

Avatar




PM

Gender: Male
Posts: 3635
xx Re: Hiding in plain sight
« Reply #25 on: Jul 24th, 2017, 07:21am »

Interesting that "pattern" aroze on crossing "every 8th character" and fixed line length.
User IP Logged

Q: "And if I took your codes and compile them, and sell them for a profit"?
A: Go ahead. I had my share of good then I coded it for fun, if you can make better use of it - please do.
(enjoying JB 1.01 on WinXP, netbook and desktop)
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1255
xx Re: Hiding in plain sight
« Reply #26 on: Jul 24th, 2017, 10:41am »

Aha! I did notice that the odd text did seem to appear at intervals of around 8.

But I tried mod 8 line by line, 3 or 4 lines showed clear as bell, others clear as mud! Didn't think to try by file character number.

Thanks John, nice stumper with simple solution!

Thanks tsh73, your comment caused me to ignore the first half dozen or so odd characters and struggle on with decoding.
User IP Logged

B+
Pages: 1 2  Notify Send Topic Print
« Previous Topic | Next Topic »

Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls