Page 1 of 1

Steganography With PHP

Posted: Fri Apr 06, 2007 12:06 am
by r3n_cantiek
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi.. i'm irena, right now i'm doing my undergraduate thesis.. steganography in PHP..in a different method... i have script :

Code: Select all

$m=0;
		for($p=0;$p<ceil($iterasi/3);$p++)
		{
		$x=($m_output1[$p]%$lebar) - 1;
		$y=floor($m_output1[$p]/$lebar);
		$i=imagecolorat($pic, $x, $y);
    	$col=imagecolorsforindex($pic,$i); 
    	$col['red']=$nilaired[$m];
		$col['green']=$nilaigreen[$m];
		$col['blue']=$nilaiblue[$m];
		$red_set[$p]=$col['red']; 
    	$green_set[$p]=$col['green']; 
    	$blue_set[$p]=$col['blue']; 
		//print "<br>$x $y $red_set[$p] $green_set[$p] $blue_set[$p]";
    	imagecolorset($pic,$i,$red_set[$p],$green_set[$p],$blue_set[$p]); 
		$m++;  
 		} 
	$stego = "hasil/stego_".basename($fileCover);
	imagegif($pic,$stego);
so i want to change RGB in X and Y (X and Y, i generate with Pseudo random number generator) with new RGB. The problem is, for example:
X= 128, Y=6=> have R: 255 G:255 B: 255 change into R: 255 G:255 B: 255
X= 222, Y=12=> have R: 255 G:255 B: 255 change into R: 255 G:254 B: 255
the problem is, all position pixel that have same RGB with those position are follow to change with the last RGB.. so X=128 Y=6 change into R: 255 G:254 B: 255.
I really need help for this problem. It will be glad, if some of you could help me to solve this problem.. Thanks alot


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Fri Apr 06, 2007 5:57 am
by onion2k
I've split this from the topic you posted it in because it's really a separate issue. Could you explain what "the problem is, all position pixel that have same RGB with those position are follow to change with the last RGB" means? I can't quite work it out.

Also, if you're interested a few years ago I created a PHP steganography script and wrote an article about how it works: http://www.phpgd.com/articles.php?article=1 ... I don't think it's the same sort of thing as you're doing though.

steganography with PHP

Posted: Sun Apr 08, 2007 11:02 pm
by r3n_cantiek
I have read that article... but i used different method from that article.. i used PRNG for generate pixel position...
1.

Code: Select all

		
<?php
$m=0;
for($p=0;$p<ceil($iterasi/3);$p++)
{
$x=($m_output1[$p] - 1) % $lebar ;
$y=ceil($m_output1[$p]/$lebar) - 1;	
print "<br>$p $x $y $nilaired[$p] $nilaigreen[$p] $nilaiblue[$p]";
$warna[$p] = ImageColorAllocate($pic,$nilaired[$p],$nilaigreen[$p],$nilaiblue[$p]);
ImageSetPixel($pic,$x,$y,$warna[$p]);
}
?>
$m_output1[$p] = PRNG that i generate
nilaired[$p],$nilaigreen[$p],$nilaiblue[$p] = new R,G,B that i want to replace
the result is all position pixel that i generate, have RGB value same like the first position.For example, X= 91 Y= 452, R=217 G=217 B=217; X=128 Y=6, R= 217 G= 217 B=217, it should be R=255 G=255 B=255; and so does all position.
2.

Code: Select all

	
$m=0;
for($p=0;$p<ceil($iterasi/3);$p++)
{
$x=($m_output1[$p] - 1) % $lebar ;
$y=ceil($m_output1[$p]/$lebar) - 1;	
$i=ImageColorAt($pic, $x, $y);
$col=ImageColorsForIndex($pic,$i); 
$col['red']=$nilaired[$m];
$col['green']=$nilaigreen[$m];
$col['blue']=$nilaiblue[$m];
$red_set[$p]=$col['red']; 
$green_set[$p]=$col['green']; 
$blue_set[$p]=$col['blue']; 
ImageColorSet($pic,$i,$red_set[$p],$green_set[$p],$blue_set[$p]); 
 $m++;  
}
The result is almost correct but if we have few position pixel but have same RGB value...then the RGB value change into the last RGB value of position pixel. for example
X=128 Y=6, before replacement R=255 G=255 B=255, should be R=255 G=255 B=255, but the result is R=254 G=254 B=254
X=222 Y=12, before replacement R=255 G=255 B=255, should be R=255 G=254 B=255, but the result is R=254 G=254 B=254
.
.
.
.
X=350 Y=140, before replacement R=255 G=255 B=255, should be R=254 G=254 B=254, the result is R=254 G=254 B=254


i would be grateful if you have solution for my problem.. thank you before[/url]

This is my program

Posted: Wed Apr 11, 2007 10:43 pm
by r3n_cantiek
This is my program.. i used GIF image... It would be nice if you can found the problem of my program.. thank you...
http://www.4shared.com/dir/2449436/5ddc ... aring.html