TextHider: Make text invisible + hidden

Page 1 of 2 12 LastLast

  1. Posts : 1,049
    Windows 7 Pro 32
       #1

    TextHider: Make text invisible + hidden


       Information
    A standalone program(EXE) is available at post #5, followed by updates in later posts.
    To "hide" text means to transform it to a coded set of spaces so it looks invisible.
    To "store it invisibly in a file" means to not actually store the "hidden" text in a file, but in a property for a file, so it appears hidden (post #8, version 2 of the program)
    There's also an option to set a password which will transform the text into what looks like random garbage before it's converted to spaces

    The original post was about a VB-script program that was limited and not practical to use. However, it includes a description of the first version of the program, so I've kept that post. Click the button below to see it:
     
    This is part of an project I'm working on, but I've made a simplified VBscript version that maybe someone finds useful, interesting or maybe even educational

    Enter some text, add a password(optional) and you'll receive an "empty" string to store somewhere. Well it's not an empty string, it's spaces, 2 different types of space characters. If a password is entered the text will first be modified to a completely different text string(depending on the password). Then the text will be converted to binary code(0's and 1's) and then they will be replaced with space and the web version of space, chr 160, the non-breaking space, which you can store in most programs. If you set a password and you don't enter the exact same password(case sensitive) when you want the "hidden" text back, not even I can help you. You'll only get something that looks like random characters.
    Because of VBscript and input boxes restrictions I've set a maximum length of 30 in this version. Because each char will be transformed to 8 "spaces" because of the binary conversion.
    Questions? Just ask. Oh, and when you "hide" some text it will also do a test to see that the "hidden" text could be unhidden successfully. If you enter a non-ascii char like β it will fail.

    If anyone wants more comments in the code, let me know.

    If you use this code in VB or VBA, you can skip the input boxes and the 30 char limit and "hide" an entire document content, for example a notepad document. If someone opens the document it will appear empty at first. If checked in a better editor they will see only two types of characters. If they figure out it could be binary and tries to convert it, they will only see what appears like random crap. Assuming you set a password. Even if they find the source code they still need the password.

    Copy this to a new file, for example HidePassword.vbs
    Script:
    pgmName "Password hide"
    MIN_ASC 32
    MAX_ASC 
    255
    NO_OF_CHARS 
    MAX_ASC MIN_ASC 1

    '********************************************************************************************
    txt = inputbox("Enter text to '
    hide'" & Chr(10) & "(max 30 chars)", pgmName)
    if len(txt) > 30 then
        msgbox "Text is longer than 30 chars"
        Wscript.Quit
    end if
    key = inputbox("Enter password", pgmName)
    hdn = hide(ChangeText(txt,key))
    back = UnChangeText(unhide(hdn),key)
    if txt = back then
        dummy = inputbox("Success!", pgmName,hdn)
    else
        dummy = inputbox("FAIL! The text probably contains non-ascii characters", pgmName,back)
    end if
    '
    ********************************************************************************************


    Function 
    ChangeText(p1p2)
        if 
    p2="" then ChangeText=p1: exit function
        
    pwd p2
        chkSum 
    0
        keyPos 
    0
        e 
    ""
        
    For keyPos 1 To Len(pwd)
            
    chkSum chkSum Asc(Mid(pwdkeyPos1)) * keyPos
        Next
        keyPos 
    0
        
    For 1 To Len(p1)
            
    Asc(Mid(p1p1))
            
    keyPos keyPos 1
            
    If keyPos Len(pwdThen keyPos 1
            k 
    Asc(Mid(pwdkeyPos1))
            
    ChangeAsc(ck)
            
    ChangeAsc(cchkSum)
            
    ChangeAsc(cLen(pwd))
            
    ChangeAsc(cchkSum k)
            
    ChangeAsc(ck)
            
    ChangeAsc(cLen(pwd) * p)
            
    Chr(c)
        
    Next
        ChangeText 
    e
    End 
    Function

    Function 
    UnChangeText(p1p2)
        if 
    p2="" then UnChangeText=p1: exit function
        
    pwd p2
        chkSum 
    0
        keyPos 
    0
        e 
    ""
        
    For keyPos 1 To Len(pwd)
            
    chkSum chkSum Asc(Mid(pwdkeyPos1)) * keyPos
        Next
        keyPos 
    0
        
    For 1 To Len(p1)
            
    Asc(Mid(p1p1))
            
    keyPos keyPos 1
            
    If keyPos Len(pwdThen keyPos 1
            k 
    Asc(Mid(pwdkeyPos1))
            
    'Opposite order of ChangeAsc calls in ChangeText
            '
    and minus(-) for the 2nd parameter
            c 
    ChangeAsc(c, -(Len(pwd) * p))
            
    ChangeAsc(c, -(k))
            
    ChangeAsc(c, -(chkSum k))
            
    ChangeAsc(c, -(Len(pwd)))
            
    ChangeAsc(c, -chkSum)
            
    ChangeAsc(c, -k)
            
    Chr(c)
        
    Next
        UnChangeText 
    e
    End 
    Function

    Function 
    ChangeAsc(p1p2)
        
    'Move the Asc value so it stays inside interval MIN_ASC and MAX_ASC
        a = p1
        mLvl = p2
        mLvl = mLvl Mod NO_OF_CHARS
        a = a + mLvl
        If a < MIN_ASC Then
            a = a + NO_OF_CHARS
        ElseIf a > MAX_ASC Then
            a = a - NO_OF_CHARS
        End If
        ChangeAsc = a
    End Function

    Function hide(param)
        Dim p, i, val, bin, out
        For p = 1 To Len(param)
            bin = ""
            val = asc(Mid(param, p, 1))
            For i = (8 - 1) To 0 Step -1 '
    right to left
                
    If val And (iThen
                    bin 
    bin "1"
                
    Else
                    
    bin bin "0"
                
    End If
            
    Next
            out 
    out bin
        Next
        out 
    Replace(out"0"Chr(32))
        
    out Replace(out"1"Chr(160))
        
    hide out
    End 
    Function

    Function 
    unhide(param)
        
    Dim pbpdecbitbinout
        bin 
    param
        bin 
    Replace(binChr(32), "0")
        
    bin Replace(binChr(160), "1")
        If 
    Len(binMod 8 <> 0 Then
            unhide 
    "*ERROR* Length of hidden text is not correct"
            
    Exit Function
        
    End If
        
    dec 0
        
    For 1 To Len(bin)
            
    bp bp 1
            bit 
    Mid(binLen(bin) - 11'from right to left: len - position
            If Not (bit = "0" Or bit = "1") Then
                unhide = "*ERROR* Invalid char: " & bit
                Exit Function
            End If
            dec = dec + (CByte(bit) * (2 ^ (bp - 1))) '
    bp position from left to right
            
    If p Mod 8 0 Then
                
    'We have the 8 bits. Convert to char and save, and reset dec and bp
                out = Chr(dec) & out '
    store latest char first cause we're doing right to left
                dec = 0
                bp = 0
            End If
        Next
        unhide = out
    End Function 
    Then copy the HidePassword.vbs file and name it for example UnhidePassword.vbs Then edit that file and replace the lines between the ****************** lines with these:
    Code:
    hdn = inputbox("Enter text to unhide", pgmName)
    key = inputbox("Enter password", pgmName)
    back = UnChangeText(unhide(hdn),key)
    dummy = inputbox("Hidden text",pgmName,back)
    Happy "hiding"
    Last edited by Tookeri; 13 Nov 2014 at 17:41. Reason: info about exe program in post 5 & 8
      My Computer


  2. Posts : 4,776
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
       #2

    Usage information?


    Hi, this looks like it could be useful but I'm not really understanding how to use it. Perhaps you could watch this video and explain what I need to do with the text shown.



    Also I've tried to hide a document but I must be missing something as I can't work out how to do it!

    Any suggestions?
      My Computer


  3. Posts : 1,049
    Windows 7 Pro 32
    Thread Starter
       #3

    My explanation wasn't the best, sorry. I guess I though that only other developers would read this forum My bad.

    After you enter the text to be hidden, and then a password(or you can leave the password empty and just click OK), you receive a string containing only space characters. Here you should press Ctrl+C to copy that string. Then paste it somewhere so you can store it.

    When you do unhide you start by pasting a string of "spaces". Then in the next prompt enter the password(if you set one in the hiding step).

    The example to hide a document(the content) requires to use this code in either a VBA or a VB application. So that advice was intended only for developers. But if you want I can create a simple VB app with a large text box instead of the limited inputbox used in this example? Maybe I should've done that from the beginning instead of this perhaps bad VB-script example
      My Computer


  4. Posts : 4,776
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
       #4

    Got it now


    I've got it now - thanks for explaining. Don't worry about the document hiding - unless you really want to!
      My Computer


  5. Posts : 1,049
    Windows 7 Pro 32
    Thread Starter
       #5

    Standalone EXE version without limits


    The VBscript version wasn't practical to use so here's a better version: TextHider.zip
    It contains the EXE file and all VB code, "hidden" in a txt document with password Tookeri. A nice demo of the purpose with this app.

    TextHider: Make text invisible + hidden-texthider.png

    To hide text
    1. Enter/paste text in the 'Text to hide' box
    2. Set a password (optional)
    3. Click button 'Hide text'
    4. Press Ctrl+C or the Copy button
    5. Paste somewhere, for example Notepad. To replace any previous text press Ctrl+A before pasting

    To unhide text
    1. Copy the hidden text from where you saved it. Tip: use Ctrl+A and Ctrl+C to copy all text
    2. Click the Paste button
    3. Set the password
    4. Click the 'Unhide text' button
    5. The unhidden text is shown in the 'Text to hide' box

    Additional info

    • If a password is used the 2nd textbox(gray) will show the modified text (before it's "hidden")
    • Every char is converted to 8 0's and 1's representing the binary ascii code (incl. linefeeds, tabs etc)
      So the hidden text will be 8 times longer
    • The 0's and 1's are then converted to spaces and non-breaking spaces (ascii code 160)
    • Text hidden with the VBscript in post 1 is incompatible with this version

    The 2 kinds of spaces may look the same visually. Most programs can store the non-breaking space but you should verify that you can unhide the hidden text from where you stored it.
      My Computer


  6. Posts : 4,776
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
       #6

    TextHider works perfectly


    Fantastic! It's much easier to use and I had no problems following your instructions.

    Thanks very much indeed.

    Can't rep you at the moment!
    Last edited by Callender; 02 Nov 2014 at 12:36. Reason: add info
      My Computer


  7. Posts : 1,049
    Windows 7 Pro 32
    Thread Starter
       #7

    Great, thanks :)

    Forgot to add one thing: this version also tests that the process can be reversed when you hide some text. You can add this non-ascii character in the text for test purposes, and then click 'Hide text' to see what it looks like: β

    I'll see if I can come up with some new features.....
      My Computer


  8. Posts : 1,049
    Windows 7 Pro 32
    Thread Starter
       #8

    TextHider v2 - Invisibly store the "hidden" text in a file


    Program description:

    • Converts text to a group of two types of space characters so the text appears invisible
    • Option to save the invisible text(or "hidden" text as I call it) to a file without modifying the file's original content or file size
    • Option to set a password which will transform the text to what looks like random garbage before it's converted to spaces


    TextHider_v2.zip A pretty cool new feature I think. Some info is in the screenshot:
    TextHider: Make text invisible + hidden-texthider_v2.png

    Additional info

    • 2 new buttons: Load ADS, and Save ADS. The Load button behaves like the Paste button, so after you have to set the password and click the "Unhide text" button
    • The Save button will overwrite any previous "hidden" text in the selected file (ADS named "TH")
    • Alternate Data Streams (ADS) are an NTFS feature. It's like an extra property for a file, and won't modify the files original content
    • By copying a file with an ADS to a non-NTFS disk, the ADS will be lost. This includes emailing the file or uploading it to a web site (that's why there's no ADS in the attached exe file)

    As long as you don't see any error messages, everything is working Happy hiding!
    Last edited by Tookeri; 14 Nov 2014 at 10:59. Reason: added program summary
      My Computer


  9. Posts : 2,663
    Windows 8.1 Pro x64
       #9

    This is really neat, nice work!
      My Computer


  10. Posts : 1,049
    Windows 7 Pro 32
    Thread Starter
       #10

    Requirements and related info


    Thank you! That reminds me I have a new version almost finished that supports more than ASCII characters, although the current version is enough for the English language and some other languages that have additional characters covered in the extended ASCII table.

    I forgot to add requirements and related info in case anyone is wondering:

    • .NET Framework 4 Client Profile (which should already be installed as a recommended update in Windows Update) or the full .NET Framework 4
    • Portable program - no installation
    • Standard user account (no administrator/UAC prompts)
    • Does not create network connections or read/write local files (other than what the .NET Framework does by itself or when you use the Load ADS and Save ADS buttons)

    Note: saving as an ADS only works on NTFS drives! If you move/copy a file with an ADS file to for example a USB flash drive with FAT32 you'll get a warning that a "property" for the file will be lost. But if you upload the file somewhere or attach it to an email, you won't receive such a message but the ADS will still be lost. So any backups of these files should be done to another NTFS drive.
      My Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 15:11.
Find Us