It is currently Fri Nov 15, 2019 8:17 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 45 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Fri Oct 14, 2016 9:15 am 
Offline
Addict
Addict

Joined: Sat Mar 02, 2013 9:17 am
Posts: 931
Hi,
nice too see new features
I have maked a quick look in your code, and see, you generate the IV with RandomSeed(0)
I think, it is simple for coupling your passwords with this,
so you become a automatic changed IV, a static IV is not a good idea, i think...

As sample :
Code:
UseCRC32Fingerprint()

password1$="Hello"
password2$="World"
result$=password1$+password2$+"salt_&%)?//``/c"
result=Val("$"+Fingerprint(@result$, StringByteLength(result$), #PB_Cipher_CRC32))
Debug result
RandomSeed(result)

_________________
http://www.nachtoptik.de


Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Fri Oct 14, 2016 5:12 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1592
Hi walbus,

Thank you for the information, a dynamic seed makes a lot more sense.

-------------------------------------------------------

Updated:
- replaced the static seed with a dynamic seed

-------------------------------------------------------

Updated:
- fixed an issue in the Header Password algorithm

1. Open the application and enter a custom Header Password and Bit Password.
2. Embed a file.
3. Save the image.
4. Close the application.
5. Open the application, but only enter the previously used Header Password.
6. Open the previously saved image.
7. You're able to view information on the embedded file, but extracting the file is still encrypted.
8. Each embedded file (bit) can have a different Bit Password (change password before embedding next file).

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Tue Feb 27, 2018 5:20 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Fri Oct 14, 2016 7:08 pm 
Offline
Addict
Addict

Joined: Sat Mar 02, 2013 9:17 am
Posts: 931
Hi JHPJHP,
looking very good

Best regards Werner

_________________
http://www.nachtoptik.de


Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Fri Oct 14, 2016 7:44 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1592
Hi walbus,

Thank you for your comments and support.

--------------------------------------------------

Updated:
- added Show Password option to the Header / Bit Security window

This was added to help avoid mis-keying a password.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Sat Oct 15, 2016 3:55 am 
Offline
Addict
Addict
User avatar

Joined: Mon Oct 26, 2015 2:55 am
Posts: 908
Location: UA
Hi. Tnx for interesting stuff, time ago I did many own experiments this way, but never made some finished program (maybe because never really needed it). Anyway all such things are always interesting to play with :3

Btw, there is something like a bug after brief testing:
- I've used default.jpg, packed text file (95 bytes size) into it, saved to PNG, then reloaded saved image and extracted file: the output text file was 256 bytes with space above 95 bytes filled using zeros.

(hope I'm not repeating someone's else post about this, as I didn't read whole topic before posting ^^)

_________________
Dreamness

Like a copyleft notify: all the source code created by me and posted on Purebasic official forums is free to use and modification in all possible (and several impossible) ways for anyone, without asking my permission


Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Sat Oct 15, 2016 4:19 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1592
Hi Lunasole,

Thank you for testing the application and posting your results; the bug has been squashed :)

---------------------------------------------------------

Updated:
- fix a bug where files smaller then 256 bytes were padded with zeros :: reported by Lunasole

NB*: Update also includes a small change affecting OSX users.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Sat Oct 15, 2016 7:14 am 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 8006
Location: Fort Nelson, BC, Canada
Very good work! Also fun to play around with. Thanks for sharing it.

One thing I noticed, how are you squaring this:

Code:
Structure InitializationVector
  b.a[32]
EndStructure

with this:
PB doc wrote:
*InitializationVector: The InitializationVector is a random data block, used to initialize the ciphering to avoid breach in decoding (only needed when using the #PB_Cipher_CBC mode). The initialization vector is always 16 bytes long.

_________________
Veni, vidi, vici.


Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Sat Oct 15, 2016 7:45 am 
Offline
Addict
Addict

Joined: Sat Mar 02, 2013 9:17 am
Posts: 931
@netmaestro
I self think, he has this simple oversight, it has not a negative effect.
The best way is adding a other crypt randomized IV to each file to encrypt

Friendly hint : This should you change also in your own tool, i think... :wink:
http://www.purebasic.fr/english/viewtopic.php?f=14&t=43141&start=45

A complete tool how not change immediately the IV is absolutely not a good idea

In older PB documentation the IV was false with 32 bytes specified
And to time, i think the documentation should a explanation what the IV is and what he exactely do

So, many users use the IV false, or think he make wonders

How one make more, it is interesting for looking in the Wikipedia how it works and what it exactely do
This is also the 'key' for understanding how other cypher modes primary works
https://de.wikipedia.org/wiki/Cipher_Block_Chaining_Mode

And unfortunately, using CBC is not ever the best idea....

_________________
http://www.nachtoptik.de


Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Mon Oct 17, 2016 1:56 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1592
Hi netmaestro,

Thank you for your comments and correction.
- I was originally using the DataSection included in the documentation until I found this older post by you: [PB 4.40] AES encryption: Streaming demo :mrgreen:

Your words, contributions, and support are very much appreciated:
netmaestro wrote:
Some years ago I adopted a policy of always sharing source code for projects released on the forums, for a couple of good reasons. One, coders on the forum including me are here to learn and pick up new skills in PureBasic. If people are releasing libraries and programs without source, the collaboration benefits to everyone are lost. Sharers benefit too by getting useful critique from other coders and learning to do things in a more polished or efficient way.

BTW: Windows Cryptor is very impressive with some nice graphics and sound effects.

-------------------------------------------------------------------

Hi walbus,

Thank you for the additional information: Block cipher mode of operation (English version).

-------------------------------------------------------------------

Updated:
- modified the InitializationVector Structure as posted by netmaestro
- fixed an issue in the Drag and Drop Procedure

Something you might find interesting:
- open the application, close the password window (not relevant with this demo)
- click the first bit (far left: bit 7)
- embed a file (EmbedLSB.pb is suitable for this demo)
- double-click the main image to open a visual representation of the changes

The modified bits should be noticeable in both the encrypted header and body.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Mon Oct 17, 2016 11:27 am 
Offline
Addict
Addict

Joined: Sat Mar 02, 2013 9:17 am
Posts: 931
Hi JHPJHP
You can optimize your IV before using, so :
(Sorry, i have forget this last step)
This encrypt the IV with your used key, i'ts 100% OK
Code:
AESEncoder(*IV, *IV, 16, *Key, 256, 0, #PB_Cipher_ECB)


IV creating with a structure is not needed
Simplest so , i think..
Code:
Dim IV.q (1)
RandomData(@IV(0), 16)


Creating the 32Byte Key from Ascii here reduce the Key komplexity to 16 Bytes
Creating the 32Byte Key from a 256Bit hash as sample so :
Code:
ii=0 ; Create a 32Byte Key from a 256Bit hash(Ascii and Unicode)
For i = 0 To 31 : PokeA(@IV(0)+i, Val("$"+PeekS(@key$+ii, 2))) : ii+SizeOf(character)<<1 : Next


Also, a little,
The dialog extract file > break, break not directly

Regards Werner

_________________
http://www.nachtoptik.de


Last edited by walbus on Mon Oct 17, 2016 3:07 pm, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Mon Oct 17, 2016 2:32 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1592
Hi walbus,

Thank you for your new post.

I really like the idea of encrypting the IV with the Key, and have adopted it into the application.

I know a Structure isn't needed, but I still prefer it.

I believe I'm already creating a 32 byte Key from a 256 bit hash by using Fingerprint with #PB_Cipher_SHA3.

------------------------------------------------------

Updated:
- modified the AES_EncoderDecoder Procedure and the AES_CipherBuffer Procedure
- fixed a bug in the Button3Handler Procedure

NB*: Changes were based on recommendations provided by walbus.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Tue Feb 27, 2018 5:22 am, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Sat Oct 29, 2016 3:43 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1592
Updated:
- added direct folder embedding
-- new button and context menu item
- updated Drag and Drop to include folders
- added multi selection when embedding files
- brought back the compression algorithm (bug fix)
-- results returned to the information area: EMBEDDED SIZE
- added shortcut keys
-- Left / Right Arrow: change the active bit
-- Escape Key: close the password window / exit the application
- applied a few cosmetic changes
- fixed a couple hidden bugs

Using the new folder embedding feature on the default image, I was able to embed the folder OpenCV_32 (no subfolders) containing over 240 script files into a single bit.

NB*: It may be worth noting that errors were only evident after Purifier was enabled.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Sun Oct 30, 2016 8:42 pm 
Offline
Addict
Addict

Joined: Sat Mar 02, 2013 9:17 am
Posts: 931
Very nice News JHPJHP

_________________
http://www.nachtoptik.de


Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Mon Oct 31, 2016 2:13 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1592
Hi walbus,

Thank you for the comment.

------------------------------------------------------------

Updated:
- set a cap on the precompression folder size test
- more detailed message information
- added additional prompts
-- overwriting bits, overwriting files, overwriting folders
- applied a few cosmetic improvements

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Tue Feb 27, 2018 5:22 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: LSB File Embedding
PostPosted: Tue May 28, 2019 4:20 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1592
Updated:
- for PureBasic 5.60 +
-- compatibability with previous versions has been removed

----------------------------------------------------------

Updated (Windows):
- image sizes configured to use the built-in PureBasic DPI compiler option

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 45 posts ]  Go to page Previous  1, 2, 3

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye