Steganography Project

33,494
-1

Published on

5 Comments
12 Likes
Statistics
Notes
No Downloads
Views
Total Views
33,494
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
4,457
Comments
5
Likes
12
Embeds 0
No embeds

No notes for slide

Steganography Project

  1. 1. PROJECT REPORT onSECURITY EXTENSIBILITY IN STEGANOGRAPHY submitted in partial fulfillment of the requirements for the award of the degree of BACHELOR OF TECHNOLOGY (INFORMATION TECHNOLOGY) of UNIVERSITY OF MADRAS by MADHAN. R (9002164) RAJESHKUMAR. M (9002176) SWAMYNATHAN. S (9002196) under the guidance of Ms. CHENTHILBANU,M.E., ( Lecturer,Departmentof InformationTechnology) APRIL 2004 DEP ARTMENT OF INFORMATION TECHNOLOGY S.R.M. ENGINEERING COLLEGES.R.M. Nagar, Kattankulathur, Kancheepuram District - 603 203.
  2. 2. BONAFIDE CERTIFICATE This is to certify that the project work entitled SECURITY EXTENSIBILITY IN STEGANOGRAPHY is a bonafide work done by the requirementsfor the award of the degree of Bachelor of Technology . In INFORMATION TECHNOLOGY Hea~epartmenl Submitted for university examination held in April 2004 at S.R.M. Engineering College, Kattankulathur. 60/ External Examiner Date:l4 - .; - .l"" ~ ,nte4ner---- - -
  3. 3. ACKNOWLEDGEMENTThey say, "Rome was not built in a day". Persistence, commitment, and sincerity haveindeed contributed to the successful completion of our final year project SecurityExtensibility in Steganography. But without the support and encouragement of many,our efforts would have gone meaningless.We first and foremost thank the Almighty for our projects success.We extend our gratitude to our respected chairman Mr. Pachamuthu, Principal Prof.R.Venkatramani and our Director Dr. T.P.Ganesan for the infrastructure they haveprovided us with and which has been conducive to our pursuits.We are extremely grateful to the Head of the Department of Information Technology,Prof. S.Rajendran for having supported and encouraged us all along.We are profoundly obliged to our project coordinator and Senior Lecturer, Department ofInformation Technology, Mrs G.Vadivu, for being the backing force without which wewould not have been motivate enough.Our very special thanks go to our guide and Lecturer of Department of InformationTechnology, Ms ChenthilBanu M.E without whose constant help, suggestions andadvice, we would not have come this far.We owe a lot to Mr.S.Ashok and Mrs.Vadivu for suggesting improvements andenhancements.Weare also greatly indebted to our parents and friends for their moral support and thewhole Information Technology department for all the encouragement.Last but not the least, the experiences of working together were not only enjoyable butalso very beneficial.
  4. 4. ABSTRACT Steganography is the art of passing the infonnation in the manner that the very existence of the message is unknown. The goal of steganography is to avoid suspicion to the transmission of hidden message, such that it is highly secured. Steganography is the art of concealing the existence of infonnation within seemingly innocuous carriers. Steganography can be viewed as akin to cryptography. Both have been used throughout recorded history as means to protect infonnation. At times these two technologies seem to converge while the objectives of the two differ. Cryptographic techniques "scramble" messages so if intercepted, the messages cannot be understood. Steganography, in an essence, "camouflages" a message to hide its existence and make it seem "invisible" thus concealing the fact that a message is being sent altogether. Steganography has its place in security. It is not intended to replace cryptography but supplement it. Hiding a message with steganography methods reduces the chance of a message being detected. One of the most commonly used methods is Least Significant Bit (LSB) algorithm. This deals with the embedding of message along with the image file where each pixel is of size 3 bytes. Each and every bit of the message is taken and is embedded along with the bytes of the image file such that, its inclusion does not make a perceivable change in the message embedded file. Incase of confidential infonnation that should be sent, provision of security is an inevitable issue which cannot have any compromise. This algorithm that is commonly used in this field has a major loophole. That is the ease of cracking the messages that is hidden in the image file. This is due to the simplicity of the algorithm that gave room for the easy cracking of the messages. Thus the Security Extensibility algorithms called SRM algorithms for steganography, cryptography, password authentication, digital watennarking which is developed by our own is used to provide more security such that the cracking is made quite tough which is almost improbable.--- --- - -
  5. 5. .. r - -11-- I INTRODUCTION Synopsis 1 Existing Systems 2 Background 3 LSB 5 Drawbacks of Existing Systems 12 Need for new system 12 Proposed system 13 II SYSTEMANALYSISSECURITY Study of Components: Sender side 14EXTENSIBILITY Receiver side 15INSTEGANOGRAPHY SRM algorithm for steganography 15 SRM algorithm for cryptography 18 SRM algorithm for Password 21 Authentication SRM algorithm for Watermarking 22 Functional Requirements 25 . Emedding(LSB) . Extracting(LSB) . Embedding(SRM algo) . . Extracting(SRMalgo)
  6. 6. . Encrypting . Decrypting . Authentication . Watennarking System Requirements 32 . Hardware Requirements . Software Requirements III SYSTEMDESIGN System Architecture 33 Program Modules 34SECURITYEXTENSIBILITY Algorithms 45IN . LSB algorithmSTEGANOGRAPHY . SRM algorithm for embedding . SRM algorithm for Extraction . SRM algorithm for Encrypting . SRM algorithm for decrypting . SRM algorithm for authenticity . SRM algo for Watennarking System Testing and snapshots 58 Test Case Design 75 IV CONCLUSION Advantages 75 Future Enhancements 76 Applications 77 V REFERENCE 78 VI APPENDIX 80 Sample Code ---
  7. 7. Introduction:Synopsis:Steganography is the art of passing the information in the manner that the very existence of themessage is unknown. The goal of steganography is to avoid suspicion to the transmission ofhidden message, such that it is highly secured. Steganography is the art of concealing theexistence of information within seemingly innocuous carriers. Steganography can be viewed asakin to cryptography. Both have been used throughout recorded history as means to protectinformation. At times these two technologies seem to converge while the objectives of the twodiffer. Cryptographic techniques "scramble" messages so if intercepted, the messages cannot beunderstood. Steganography, in an essence, "camouflages" a message to hide its existence andmake it seem "invisible" thus concealing the fact that a message is being sent altogether.Steganography has its place in security. It is not intended to replace cryptography but supplementit. Hiding a message with steganography methods reduces the chance of a message beingdetected. One of the most commonly used methods is Least Significant Bit (LSB) algorithm.This deals with the embedding of message along with the image file where each pixel is of size 3bytes. Each and every bit of the message is taken and is embedded along with the bytes of theimage file such that, its inclusion does not make a perceivable change in the message embeddedfile. Incase of confidential information that should be sent, provision of security is aninevitable issue which cannot have any compromise. This algorithm that is commonly used inthis field has a major loophole. That is the ease of cracking the messages that is hidden in theimage file. This is due to the simplicity of the algorithm that gave room for the easy cracking ofthe messages. Thus the Security Extensibility Algorithm is developed and can be implementedwhich provides a good security comparing to this LSB algorithm. page 1
  8. 8. Embedding of the messages in a 24-bit color image, is fully dependent on thealgorithm used and the security of the hidden image from being retrieved by some enigmaticperson is the main factor to be focused Many concepts that enhance the security of the message transfer is used.They are 1. Use of digital watermarking. 2. Use of Cryptography(algorithm developed by our own) 3. Ability to send more than one message file in the same image file. 4 .password authenticationExisting Systems:The existing system algorithm in steganography is LSB algorithm. This means Least SignificantBit algorithm. This steganography entered into the computer technologies during the hours ofseptember 11 incidents by Osama Ben Laden.. But before that it was resident and was used forsecured communication of messages outside computer technology. Some of the examples are 1. Text hidden on wax tablets 2. Null ciphers Example: Message sent by a German spy in world war II Apparently neutrals protest is thoroughly discounted and igllored. Isman hardhit. Blockage issue affects the pretext embargo on products, ejecting suets and vegetable oils. page 2
  9. 9. Exact answer is found by choosing only the second letters of each and every word. The answerwould be Perishing sailsfrom NY June 1.Back GroUlld:Steganographic software is new and very effective. Such software enables information tobe hidden in graphic, sound and apparently "blank" media. Charles Kurak and JohnMcHugh discuss the implications of downgrading an image (security downgrading) whenit may contain some other information [Kurak92]. Though not explicitly stated theauthor(s) ofStegoDos mention embedding viruses in images [StegoDos].In the computer, an image is an array of numbers that represent light intensities at variouspoints (pixelsl) in the image. A common image size is 640 by 480 and 256 colors (or 8bits per pixel). Such an image could contain about 300 kilobits of data.There are usually two type of files used when embedding data into an image. Theinnocent looking image which will hold the hidden information is a "container." A"message" is the information to be hidden. A message may be plain-text, cipher text,other images or any thing that can be embedded in the least significant bits (LSB) of anImage.For example: Suppose we have a 24-bit image 1024 x 768 (this is a common resolution for satellite images,electronic astral photographs and other high resolution graphics). This may produce a file over 2megabytes in size (l024x768x24/8 = 2,359,296 bytes). All color variations are derived fromthree primary colors, Red, Green and Blue. Each primary color is represented by I byte (8 bits).24-bit images use 3 bytes per pixel. If information is stored in the least significant bit (LSB) ofeach byte, 3 bits can be a stored in each pixel. The "container" image will look identical to thehuman eye, even if viewing the picture side by side with the original. Unfortunately, 24-bit page 3
  10. 10. images are uncommon (with exception of the formats mentioned earlier) and quite large. Theywould draw attention to themselves when being transmitted across a network. Compressionwould be beneficial if not necessary to transmit such a file. But file compression may interferewith the storage of information.As many people think, steganography and cryptography are not same. They are different. Theyare differentiated based on the following aspects based on david kahns thesis.David Kahn places steganography and cryptography in a table to differentiate against thetypes and counter methods used. Here security is defined as methods of "protecting"information where intelligence is defined as methods of "retrieving" information[Kahn67]:[SignalSecurity -ISignal Intelligenc-; - ----Communication Security .Communication Intelligence . - -- - Steganography (invisible inks, open codes, messages III hollow heels) and . Interception and direction- Transmission Security (spurt radio and finding spread spectrum systems) . Cryptography(codes and ciphers) . Cryptanalysis --- -,_.- -.- - · Traffic analysis (direction- · Traffic security(call-sign changes, dummy: finding, message-flow messages, radio silence) studies, radio finger printing) --.--.- --,- - -, - .- page 4
  11. 11. Electronic Security Electronic Intelligence ! . Electronic Reconnaissance . Emission Security (shifting of radar I (eaves-dropping on radar frequencies, spread spectrum) emissions)r . Counter-Countermeasures "looking I I I ,--r------- . Countermeasures (jamming through" (jammed radar) radar and false radar echoes) ---~-~--- - Table 1: Kahns Security Table LSB algorithm: In LSB algorithm, the message bit is taken from the message byte and then that particular bit will be embedded inside the least significant bit of an image or video or audio file. This is done because.. l.The message embedded in the least significant bit of an image file will not draw the suspicion of the hacker as the minute difference that would be made in the pixel value of the image file will not be perceived by the normal naked human eye. 2.The message that will be embedded in the LSB of an audio file will not create suspicion to the hacker as that change would not be perceived by the human ear. 3.The same concept works out even with video file. 4.This same algorithm can also be used for digital Watermarking. page 5 ---
  12. 12. The file where we actually embed the message is known as cover file. The usual files thatare selected as cover file are image, audio, video, text data. But using text data as a coverfile will encipher the message than hiding the message. So logically this cannot be told assteganography.Implementing Steganography in LSB:-Steganography can be implemented using LSB algorithm in two ways (1) Using keys (2) Without using keys. Now let us see a small example of how the message will be stored. Consider 8 bytes of a cover file(say bitmap image).Let the 8 bytes be 11111010 10101010 11110000 01010110 10010010 01101110 page 6
  13. 13. 10000100 11000000 Consider a message byte 11111111.we should embed all these 8 Is into the image file. Since we are going to use the LSB algorithm we need 8 bytes from cover file to embed a byte of message file. This is done by, covering each and every bit of the message file by the LSB of the cover file. The final answer would be 11111011 10101011 11110001 01010111 10010011 01101111 10000101 11000001The Is with underlining denotes the message bit embedded in the cover file. page 7
  14. 14. In case of LSB without key , it is nothing but embedding all the message bits in thesuccessive bytes. Message is Cover embedded File(Image, into the Least audio, video Significant File is files) Bit of the Decoded coverfile and and now this is message IS an Encoded got Picture. Message to be embedded.The file size will be embedded as a header in the embedding process itself by the senderso that it would help the receiver to decode only that particular amount of bytes from thecover file thereby not wasting time in decoding the bytes that does not have any messagesembedded in it. Another important constraint is the size of the message file should notbe greater than l/Sth of the size of the cover file.In case of LSB with key, we add an extra key such that based on the key value, thenumber of bytes will be traversed. For example after embedding in the LSB, the keyvalue will be checked and if the key value is n, after n number of bytes the bit will beembedded. This type of embedding can be done in image file and it was once done usingthe digital message that is passing in ISDN phone lines. It was Hiding messages in thenOIse of ISDN telephone page 8
  15. 15. conversations. Telephone 1: Telephone 2: Sender: Receiver: Message is hidden by the The same key is the lowest bits in generated in the transferred byte receiver side and the sequence.Distance distance is found and between changed bits is then the embedded bit determined by the is retrieved. stegokeys.This can even be explained with a better example by giving the test data and how it willbe encoded. The main thing that should be taken care is the key that is generated in thesender side that is the stego key generated in the sender side should be generated in thereceiver side to retrieve the message from the cover bytes. Else it would not be possiblefor the receiver to decode and at the same time, the number of bytes needed in this casecannot be determined during the algorithm design time. It is totally dependent on thestego key and message file size.Now let us see the exemplification given for this algorithm below. In sender side the key is generated and based on the key we are embedding the message into the cover bytes andthis is generated again at the receiver side and we uncover the elements from the covered file. page 9
  16. 16. Original Embedded Key Byte Message Sequence (cover) 01010101 0 1 01010101 0 1 01010100 1 0 01001010 0 2 00010100 1 1 11101001 1 0010101 )1 0101010Q010101000100101Q00010101 Fir t 3 bits getting embedded and key no. of bytes Are left un encoded. Key Embedded Message Cover 1 0 01010101 1 0 0101010* 0 1 01010100 2 0 0100010* 1 1 0001010* 0 1 11101001 page 10
  17. 17. How to choose the cover file incase of an image?The main thing that should considered in choosing an image file as a cover file is thecompression method. There are two types of compression methods.Lossless Compression (Ex: GIF,BMP) . Original infonnation remains intact . Original message can be reconstructed exactly Lossy Compression (Ex: JPEG) . yields very good compression . may not maintain the integrity of the original messageA 24-Bit Bitmap image:(a) A 24 bit bitmap image is made up of pixels of size 24 bits.(b) The pixel has 8 bits of Red, Green and blue values respectively(c ) So the color variations are derived from these 3 primary colors.(d) Infonnation is stored in the LSB of 3 bytes. page 11
  18. 18. Drawbacks of the Existing Systems:Though LSB has the advantages like easy implementations, it also has its unavoidabledrawbacks. Once if the hacker is aware of the presence of message in the cover file, hewill first use the LSB algorithm and so it gives very less security to the message. Moreover as the name refers only LSB of the cover byte is used and other bits are not used asit may create changes in the cover file and it would draw suspicion and tends to easysteganalysis.So if a confidential message is expected to send, then it should guarantee full security andit should make the hacker to consume his/her maximum amount of time hack the content.Need for new system:As there is no proper security promise in the LSB algorithm, a new algorithm has beenproposed and designed by us known as S.R.M algorithms which satisfies the followingfactors I.Inability to hack the content immediately 2. Encrypt and Embed 3.Digital Watermarking page 12
  19. 19. 4.Password AuthenticationSo these aspects stands as a tool for extending the security in the steganography.Proposed Systems:As said above this security is reinforced by 4 concepts 1. S.R.M algorithm for Steganography 2. S.R.M algorithm for Cryptography 3. S.R.M algorithm for password authentication 4. Digital Water Marking Now let us see each and every algorithm in detailed SENDER RECEIVER 1. WATERMARKING l.P ASSWORD AUTHENTICATION 2.WATERMARKING 2.ENCRYPT THE VERIICATION MESSAGE 3. EXTRACTING THE MESSAGE 3.EMBED THE MESSAGE 4.DECRYPTING THE MESSAGE page 13
  20. 20. - - --.. . - . . - -- - .. _ __ _ _ ___ h This is the general structure. Now let us see each and every algorithms and methods. This system encompasses all the aspects of network security algorithms. The main concepts of network security is 1.The data should be sent from a recognized sender 2.The data should reach the legitimate receiver. 3.Data Integrity. So all these three main concepts are implemented. The following is implemented in our project as (a) Password authentication.. ..to check for legitimate receiver (b) Digital Watermarking to verify for the right sender (c) Cryptography &steganography algorithms.. ...data IntegritySo our proposed system composes all these things.SYSTEM ANALYSYS:Study of Components page 14
  21. 21. Sellderside Plain text Encrypt - WaterMark Embed Image with messageReceiver Side:Embedded &Encrypted r Password Digitaltext inside Authentication Watermarkingbitmap verificationimagefile. Extraction of encrypted message from the file 1 Decryption of Message message r retrieving
  22. 22. S.R.M Algorithm for Steganography:Working:This algorithm is designed by our own which perfonns the following functions:The user will prompted to give embedding key.The key that is given by the user will be taken as a seed and a random number will begenerated.Then that random number will be moded by 8 and the reminder is the chosen bit position.The message bit will be taken and embedded in that position.EX:Let the key that will be given by the user is 23456.This is taken as a seed to a random function and a random number will be generated andlet that number be 12541.This 12541 will be moded by 8, 12541%8=5.So the message bit will be embedded in the first bit.So how this was made feasible? Doesnt it change the pixel value?The answer to this main question is an emphatic no. Because let us consider the followingconditions of moded value.If the moded value is 0 then LSB is used page 16
  23. 23. If it is not 0 but some value n(where n<8) then that nth bit is seen. If both the message bitand the nth bit are same(either both should be one or both should be zero),then the bit isnot embedded but that particular nth bit is directly considered as a message bit(as boththe values are same) and LSB is made O(inthis state LSB acts as a flag)If the nth bits value and message bits value are not same then the LSB is made1(indicating that the message bit is NOT of the nth bit).Since all the bits are involved and at the same time there wont be a any change in thepixel value, this would be more secured.How about key synchronization?The next question that would be framed in ur mind is about the key synchronization. Howwas it possible?There is a Class called random in JAVA.We need to create an instance for this likeRandom r=new random(seed);r.nextintO;This generates a random number in a particular sequence and always returns the samesequence of numbers for a particular key in any system. So there will not be any problemif the same key is used.Ex for its working:Let the bit position be 5.Message byte=10101101 page 17
  24. 24. Message bit to be embedded=IImage byte=IIQIOIII. change the LSB to IIQIOIIQThe bit to be embedded is I.But the bit in the fifth position is having O.If I is directlyembeded then there will be a human eye perceivable change in the pixel value. To avoidthat what we actually do is we again change the LSB of image byte to llQOll~ ThisLSB acts as a flag means, the value of the message bit stored is NOT of the value of thebit in 5thposition.Value of the bit in 5thposition is O.Its NOT value is I.So the message stored is 1.The same process is used to retrieve the message in the receiver side.Advantages: 1. Message can not only be embedded in LSB but also in any of the 8 bits. 2. LSB acts as flag at certain circumstances. 3. Choosing of bit message to embed the message is totally randomized. 4. No need for algorithm secrecy. 5. Key secrecy. 6. Any file can be embedded to any file provided the cover file should 8 times greater than the file that is going to be embedded.S.R.M Algorithm for Cryptography:-Working:This algorithm is designed by our own which performs the following functions:1.The user will be asked to enter two keys page 18
  25. 25. (a) Algorithm selection key (b) Key for Encryption2. Here 2 main algorithms are developed and 8 more algorithms are developed whichmainly inherits the concepts of the 2 main algorithm there by making a number of 10.3.The algorithm selection key concept works like this 213453452789012345Enter the algorithm selection key:Enter the algorithm Encryption key 12345678Working of algorithm selection key:Each and every digit in the algorithm selection key refers to the corresponding algorithmof the 10 algorithms.See the sequence213453452789012345The message will be encrypted using algorithm 2, then my algorithm 1,then by algorithm3 ..and at last by algorithm 5.And the encryption key is used for selecting the bits and inverting there by emulating theconcept of encryption. page 19
  26. 26. The working of this encryption is best defined by the following diagram.Let the algorithm sequence be XYZ and let the encrypting key be KEYEncryption diagram:Algorithm X is first Algorithm Y will Algorithm Z willused to encrypt the encrypt the message encrypt the text thatmessage file or the that is already is already encryptedplain text using the encrypted by by X and Y using (KEY Algorithm X using KEY. the same key KEY.KEY KEY KEYDecryption:Algorithm Z is first Algorithm Y will Algorithm X willused to decrypt the decrypt the message decrypt the text thatencrypted file using that is already is already decryptedthe KEY decrypted by by Z and Y using Algorithm Z using KEY. the same key KEY. KEY KEY KEY page 20
  27. 27. The detailed description of the algorithm is done in the later part of the program.Advantages:I.Dependent on two keys.2.Though the encrypting key is known, if the algorithm selection is not known then themessage would not be got back.3.The same holds good on the other way around.4.The algorithm selection key can be of any size based on the user requirement andmessage confidentiality.5.Usage oflogical pipelining among various algorithms during cryptography.S.R.M algorithm for password authentication:This algorithm is designed by our own which performs the following functions: page 21
  28. 28. ......This will be used in the receiver side to check the authenticity of the receiver. The mainadvantage of this algorithm is its resistance to brute force attacks of the password. Theuser will be prompted to enter the password which will not be more than 8 characters. Ifthe user enters the password correctly, then he will be proceeding further. Else he will begiven 2 more chances to enter the password correctly. If he fails to do that then hissession to enter the password will be blocked and a log file will created entering the dateand time details of the password entered.Consider that the password is "orbit". If user types the password wrongly for 3 times thena key will be generated. How this helps? A log file which captures the system time, system date and the an output denoting password success/failure. If the password is typed correctly in the first attempt then it stores as ps(password success), else it does not print anything. How administrator use this? The administrator can verify the logfile such that he will be aware of the real hack that is going on and he can make various arrangements to save based on that. Advantage: I.Resistence to bruteforce attacks page 22
  29. 29. 2.Creation oflogfile storing all vital detailsDigital Watermarking:Digital Watermarking is nothing but a way to find whether a message has beenreceived trom the exact sender.This is verified in the receiver end.Working:The signature of the sender is embedded in the cover file which will be regarded as aseparate header will be done.Then the message should be encrypted and embedded.The embedded message will reach the destination and first the user at the receivingside will type the sender name and verify it. If the string matches then he will befurther proceeding with uncovering and deciphering of the messages. Else he will notbe able to do so.Consider that the sender name isSRMITES. This will be embedded as a header to the cover file.The receiver should some know the sender and a legitimate receiver will be knowingthat.After entering the name it will be checked and the process flows based on theoutput.Advantages: page 23
  30. 30. 1. A good method to ensure whether a particular message is from a right sender.2. No masquerading can be done by a third person by putting wrong watermarking as the message that is going to be watermarked will be a secret one.Functional Requirements:Focusing the project in the aspect of functional requirement, we can split intofollowing modules. LSB algorithm S.R.M algorithm for Embedding (Steganography) S.R.M algorithm for Extracting (Steganography) S.R.M algorithm for Encrypting (Cryptography) S.R.M algorithm for Decrypting (Cryptography) S.R.M algorithm for Embedding (Watermarking) S.R.M algorithm for Extracting and verifying (Watermarking) S.R.M algorithm for password Authentication Interfaces and IntegrationFunctions of LSB algorithm:In our first module, we have just implemented the LSB algorithm which is nothingbut embedding the message bits in the least significant bits of the cover file .In theimplementation of LSB algorithm we have defined the following functions. page 24
  31. 31. They are1. A Main function2. A function to check whether the file which should be embedded is less than 1/Sth of the size of the cover file.3. A function which embeds only the header information of the source cover file to the destination and making it ready to act as a file which holds the contents of message file.4. An Embedding function which embeds the message files contents to the cover file.5. An extraction function which extracts the message from the cover file.Functions Explanation:First we will be checking the file size of the file that is going to be embedded becausethe file can be embedded only if it is lesser than 1/Sthof the size of the cover file. Soin this function we will get the file size of both the cover file and also the messagefile.Then we will be writing the header information to the destination file. That is anoperating system can recognize the type of file by reading the information specifiedin its header. In bitmap image the header size is of 54 bytes and if it is a wav file thenit is of 12 bytes. So the first 54bytes(incase of bitmap image) or 12 bytes(in case ofwav file) is taken an directly written to the destination file as soon as it is opened.Then we will take each and every bit of the message file and embed it into the leastsignificant bit of the cover file.During Extraction process we will uncover the bits in the LSB and we willamalgamate it to reproduce the embedded message. page 25
  32. 32. Functiolls of SRM algorithm for Stegallography (Embeddillg):In SRM algorithm for embedding a sequence of lines are written which performs thefollowing actions. They are1. The checking of file size which should be embedded.2. Writing the header3. Embedding the size of the embedding file into the cover file so that at the receiver side it would be easy for the receiver to get the size first and uncover the elements up to that much amount of bytes.4. Embedding of the message file.Functions Explallation:First we will be checking the file size of the file that is going to be embedded becausethe file can be embedded only if it is lesser than l/sth of the size of the cover file. Soin this function we will get the file size of both the cover file and also the messagefile.Then we will be writing the header information to the destination file. That is anoperating system can recognize the type of file by reading the information specifiedin its header. In bitmap image the header size is of 54 bytes and if it is a wav file thenit is of 12 bytes. So the first 54bytes(incase of bitmap image) or 12 bytes(in case ofwav file) is taken an directly written to the destination file as soon as it is opened.The file size if embedded into the cover file which acts as a logical header. page 26
  33. 33. Then we will generate random numbers with the help of random number generators and then mod that value with 8 and find the bit positions and check the value. If that value is 0, then normal LSB is used else message bits representing the positions are returned. Later the message bits of that positions are embedded and care is taken that only the value of LSB changes and no other bit value changes. Other than case 0, LSB acts as a flag. Functions of SRM algorithm for Steganography(Extracting): In SRM algorithm for extraction we perform the extracting of the embedded file with the help of the following functions. They are 1. Skipping of the header 2. Getting the file size which is embedded during the embedding session. 3. Extracting the text up to the n number of bytes where n is the file size. 4. Writing the message simultaneously while extracting into the same type of file.Function Explanations: 1. As we already specified that incase of an image file the first 54 bytes will be a header information, we cannot read it as mostly it will be in unprintable form, if at page 27
  34. 34. all printable, then it will be in unreadable fonn. After skipping the header file we will have our file size embedded.2. Later this file size if taken and stored in a variable and we will start to uncover the embedded elements and after recovering the embedded 8 bits from the eight bytes we will decrease the file size by 1.3. Until the file size reaches 0, we will be extracting the message bits from all bytes. The random number that is generated in the user side will be generated in the same sequence such that the exact bit position is found and we will uncover it.4. Then after uncovering the elements we will write the message into the file of its type.Functions of SRM algorithm for Encryption (Cryptography):SRM algorithm for encryption uses 2 primitive algorithms which are developed byour own and 8 algorithms which are derived from those 2 algorithms. The detailedexplanation of those 10 algorithms will be given in the ALGORITHMS section. Themain functions that are provided in this module are1. Getting the text file or any file to get encrypted2. Getting the algorithm selection key.3. Getting the key for encryption4. With the help of algorithm selection key choosing the algorithms fonning a logicalpipelining.5. Writing the encrypted file parallely into a file. page 28
  35. 35. Functions Explanation:1. At first we will be getting the file which should be encrypted. This file can be of any type.2. Then we will be getting the algorithm selection key from the user. This can be of any SIze. It does not have any constraint to the size.3. Then the encryption key is got from the user using which we will be encrypting the file.4. Then each and every character from the algorithm selection key is taken and the value is noted and the algorithm corresponding to that value is chosen and then the file is sent as an input to that algorithm. After encrypted with that algorithm we will be check the next character from the algorithm selection key and then that value is noted and the file encrypted by the previous algorithm is sent to this algorithm and this is done up to the length of the string number of times. So this process in over-all acts as a logical pipelining.5. Then after encrypting fully the encrypted message is written in a file.Functions of S.R.M algorithm for decryption (Cryptography)This file gets the encrypted file and decrypts it. For decrypting process it does thefollowing functions page 29
  36. 36. They are1. Gets the encrypted file as the input2. Gets the algorithm selection key from the user.3. Gets the key that was used to encrypt, to decrypt the file.4. Decrypts according to the character value in the reverse order.5. Gets the plaintext and writes it into a file.Functions Explanation:1. This first takes the encrypted file as the input, by giving the user the option of selecting the encrypted file.2. Then the receiver is expected to give out the same algorithm selection key.3. Then the user will be expected to enter the key that was used to encrypt the plaintext.4. Then it takes in each and every character from the last and decrypts one by one once again forming a logical pipeline from the last and then coming till first character such that the process of decryption is organized in its manner.5. Then after decrypting it writes the plaintext recovered back to a file.Functions of S.R.M algorithm for Embedding (Digital Watermarking) page 30
  37. 37. Digital watennarking means the user will be embedding some of his details or details regarding the file like license number, version, author etc. such that it would be useful for the receiver to check for the right sender. We have used the SRM algorithm for embedding in watennarking also. The functions provided by this module is 1. Getting the infonnation from the user. 2. Storing it in an array 3. Using S.R.M algorithm for embedding it embeds the infonnation into the bitmap image there by acting as a logical header defined by the user. 4. Then we will proceed with embedding of real text. Functions Explanation: 1. The user will be giving a confidential infonnation which is useful for the receiver to to check the correct sender which will be usually about the file they are sending or about the sender 2. Then that infonnation will be stored in an array and then using SRM algorithm for embedding that its storing the message bit in any bit of the byte of the cover file. Functions of SRM algorithm for extraction and verification (Digital Watermarking) page 31--- - - --
  38. 38. The functions that are provided by the extraction and verification process is 1. First the embedded message will be extracted using S.R.M algorithm of extraction. 2. Then it will be stored in some array. 3. Then it will be verified with the original description that the sender has sent and proceed for further process if it is same else it will stop, specifying an error.Functional Explanations:The message ITom the logical header created by the sender will be extracted by thereceiver and that message will stored in array. Then the receiver will be having his owncopy of that message and he will check both the values to check whether both are same.If so it is ITomthe right sender. Else it is not so.If there is any inconsistency in any of the values then the program will show an error andwill not make the receiver to proceed further.Functions of SRM algorithm for password autltenticationPassword authentication will be in the receiver side to find the legitimacy of the receiver.This password authentication protocol provides various functions. They are 1. The user should enter the password. If he enters the right password he will be proceeding further to the next session. page 32
  39. 39. 2. If not then a log file will be generated which stores the exact date and time of this password typing in that file and also the result of the password typing, whether it was a successful attempt or not. Functional Explanations: The user will be entering the password and the number of attempts will be shown. At every wrong entry of password, attempts will be reduced. Initially the attempts will be O.Ifthe no. of attempts reaches 3,there will be a log file, which captures the system date and system time. Then if the user has entered the password then it stores that the user has entered the right password. Else it will store about the details during the password entry that is the date and time in the log file.. System Requirements:Hardware Requirements: . A minimum of 300Mhz processor . A minimum of 64 Mb RAM . No strict specification about the hard disk.Software Requirements: . Windows 9812000/XPplatform . C++(optional) & JAVA . Wav file incase of data hiding in audio files, Bitmap/gif files in case of image files. . Any file to embed(music, image etc.) These are the various requirements that are needed. In case of C++ we worked on Turbo C and incase of JAVA we worked onjdk 1.3. page 33 -- --
  40. 40. SYSTEM DESIGN System Architecture:WaterMarking Encrypt Embed Transfer Password success success Password - ... Digital authentication Receive Watermarking verification Un recognised Exit sender error message decrypt Unreadable Extraction format to decrypt r Original message failur wrong decryption Unreadable Unreadable format message cannot be due to wrong page 34 decrypted decryption
  41. 41. Program Modules:There are totally 9 modules available in this project.They areModule 1 LSB algorithmModule 2 SRM algorithm for steganography (Embedding)Module 3 SRM algorithm for steganography (Extracting)Module 4 SRM algorithm for cryptography (Encrypting)Module 5 SRM algorithm for cryptography (Decrypting)Module 6 SRM algorithm for Password authenticationModule 7 SRM algorithm for digital watermarking (embedding)Module 8 SRM algorithm for digital watermarking (extraction andverification)Module 9 Interface design LSB -a programming approach:This program is done in both C++ and JAVA. Let us see this program in C++ point ofVIew.We will be getting two files as input. One file is a bitmap image and another is themessage that is going to be embedded using the fopenO function.Then we have written a function called check( ) which checks the file size of both thefiles and determines whether the message can be embedded or not.Then we have performed a function called embedding function called embed( ) wherethe real message file is embedded. Let us see how we have implemented in program. page 35
  42. 42. . ..- -. ... --Let the message byte be 11100101Let the image bytes be 11111011,11111111,11100001,01011010.We can embed the last 4 bits of the message bit in these 4 bytes. This is done byTaking the first byte of the image file that is 11111011 and bitwise and it wil OxFE sothat the value will be 11111010.Then take the message byte and first AND it with Ox01.So that we will get 00000001.Then OR both the values. We will get 11111011. Well we have embedded the messagebit in LSB of the bitmap image. To embed the next bit we shall take the next bitmap byteand then AND the message byte with Ox02.Similarly continue taking bits ITommessageby ANDing it with Ox04,Ox08,Ox10,Ox20,Ox40,Ox80 and use the same procedure andOR it and embed the message. As soon as we find the file size we should embed the filesize also so that it would be helpful in the receiver side.Then we write a function called Extract(). What we do here is, we first get the file sizeand store in a variable and then we will start to uncover each and every byte of messageand after every recovery of message byte we will decrease the file size value which is inbytes by I.Then we write it in a file.Module 2 and 3 SRM algorithm for steganography a programming approach This is implemented in JAVA. What we actually do here is we developed to differentmodules for embedding and extracting.In the embedding module we do only two things 1. Embedding the file size of the message file to be embedded. page 36
  43. 43. 2. Embedding the message text.For embedding the file size we use the code in following way....First we will get the file size by using the function in intxt.available( ). Then we willstore it in the bitmap image.i=O;while(i<4){ b=(byte)( (intxtsize&s [i]»»(i*8»; b=(byte )(b&OxOOOOOOFF); for(j=O;j<8;j++ ){ ch2=inbmp.readO; bit=(byte)( (b&arr[j]»> >j); bit=(byte)(bit&l); temp=(byte )ch2; temp=(byte )(temp&l); if(temp=bit){ outbmp. write«byte )ch2); } /lend of if else if(bit O){ temp=(byte )ch2; temp=(byte )(temp&OxFE); outbmp. write(temp); } /lend of if else if(bit 1){ temp=(byte )ch2; temp=(byte)( templl); outbmp. write(temp); page 37
  44. 44. . ._ .. _0. . . _ .. _.. . _._ . --- - ----- } /lend of if } Ilend of for i++; } /lend of whileThen we have implemented the code for embedding the text file and it is being given inthe APPENDIX part ofthis project.Similarly in order to extract the message that is being embedded we have developedanother module called NewExtractJavaIn both embedding and extracting module we have generated the random numbers andboth the numbers generated in different modules were synchronized.We have to import the following classImport java.util.Random;Then we create an object for the Random class byRandom r = new Random(seed);This generates the same sequence of number for same seed value regardless of thesystems it is used. we generate the next sequence of random number both in embeddingand extracting module by the functionr.nextIntO; page 38
  45. 45. The same thing in generated in both the modules so, there does not exist anyinconsistency in selecting the exact bit where the message bit is being embedded.Module 4 and 5.. SRM algorithm for Cryptography a programming approach:-As already said in the previous pages of this project, we will have 2 keys in thisalgorithm. Weare using 10 algorithms here where there are 2 primitive algorithm and 8derived algorithms. For random number generation we use the same class and the samefunction that we used in the previous modules. During the UNIT execution of themodules we will give the random seed, or key or algorithm selection key in the code itself. During the INTEGRATED execution the user will have the facility to input the keyin a textbox. In unit execution we give the algorithm selection code and the key in thefollowing way..fin=new Fileln pu tStream(" e:javaprogs mesg.txt"); out=new FileOu tputStream(" e:j avaprogsencrypt. txt"); String num,asel; asel=" 1111"; num=" 123456789012345"; keysize=num.lengthO; long seed=Long.parseLong(num); r=new Random(seed); filesize=fin.avaiiableO; arr=new byte(filesize]; ch=fin.readO; i=O; page 39
  46. 46. while(ch!=-l){ arr[i]=(byte)ch; ch=fin.readO; i++; } /lend of whileThe use can input the algorithm selection key which can be of any size. The detailedexplanation of all the algorithms and also the detailed codes are given in the algorithmand appendix sections respectively.Module 6.. ..SRM algorithm for Password Authentication a programming approachThis is implemented in JAVA. The user will be typing a password in the interface andthat password would be validated. If the password is correct then he will be proceedingtowards the next session of verification that is the digital watermarking. Else he will beexpected to type the password again.3 such attempts will be given to the user. If the userdoes not enter the correct password then what happens is the program will be exited andthen a log file will be created which stores all the details regarding the password entrythat is the exact date and time of entry and then stores in the log file such that theadministrator will be knowing about that and incase of any misuse he will be alarmed andhe can take necessary steps to avoid that. We have even found a new version for thatpassword generation which is put in further enhancements.String sndmame=""; this.attempt=3; do{ try { sndmame=JOptionPane.showInputDialog(this,"Enter the sendersname( exactly 6 chars):","For Authentication:attempts="+this.attempt,JOptionPane.OK_OPTION); page 40
  47. 47. if( sndmame.lengthO! =6) { JOptionPane.showMessageDialog(this,"name should be 6chars"); sndmame=""; } Ilendofif }catch(Exception e) {sndmame="";} } while(sndmame.equals()); Ilend of do-while nx=new NewExtract(this.ipbmp,this.exfile,rkey2,sndmame); JOptionPane.showMessageDialog(this,nx.result); this.attempt--; if(!nx.result.endsWith("ver!")){ aseI2=this.extasel.getTextO; this.jf.showSaveDialog(this); String outfile=jf.getSelectedFileO.getPathO; dec=new Decrypt(this.exfile,outfile,aseI2,rkey2); JOptionPane.showMessageDialog( his,dec.result); t } II end of error check The details are stored in logfile. Module 7 and 8... Digital Watermarking a programming approach:- We implemented the concept of Digital watermarking in both LSB and SRM algorithm but in overall integration we have used the SRM algorithm, but for simply the digital watermarking concept we used LSB algorithm for Digital watermarking. Watermarking using LSB is developed in C++ and SRM algorithm for Digital watermarking is done in Java. For simple explanation regarding this module we shall see the C++ code and the Java code is attached in APPENDIX part of this project. page 41 -- - --
  48. 48. void mainO{frombmp=new unsigned char[strlen(desc)];clrscrO;int q=O;q=strlen( desc);fulldetails=new unsigned char[ q];watermark wm; II object initialised// the following code checks which attribute of the file is biggercout«"tranformation is on the progress, please wait"«endl;delay(3000);wm.transformO;cout«"Water marking is on the progress, please wait"«endl;delay(3000);wm.watermarO;// watermarking is done in this functioncout«"now u r going to enter the extraction function "«endl;wm.extractO;//extraction is donefor(i=O;i<loop;i++){if(targ[i]=frombmp[i]) //checking the values for verificationcontinue;elsecout«"not verified"«endl;exit(l );} cout«" verified "«endl; delay(2000); } page 42
  49. 49. First the embedding information is stored in an array and then it is embedded in a bitmapimage. At the receiver side the user will extract the message and he will again store thevalue in an array and both the arrays are checked to hold the same values and then thecorresponding verification message is shown.INTERFACE:Our Interface will have 3 panes. The first pane can be selected to use only LSBalgorithm. The second pane can be used for SRM algorithm and the third pane is to knowabout the credits. SRM algorithm can also be used with encryption or without encryption.If it is without encryption, then the textboxes to get the input regarding the encryptionwill be disabled and no data can be entered. A textbox is provided to enter the key 2embed, extract, algo selection key, encryption key. The same interface is provided forboth sender and receiver and both the facility to embed and extract is provided within thatinterface.package New;import New.*;import java.lang. *;import java.awt. *;import j ava.awt.event.*;import javax.swing. *;import javax.swing.filechooser. *;class IntforSteg extends JPanel { static JIntemalFrame frame; JTabbedPane pane; JButton ipfile,opbmp,EmbedBut,ExtractBut; JLabel cfl ,cf2,key,status; JTextField keytxt; String infilename= ,inbmpname=,outbmpname=""; page 43
  50. 50. long inkey=O; public IntforStegO{ //constructor setLayout(new BorderLayout(5,5)); JLabel mainlab=new JLabel("WELCOME TO S.R.MSTEGANOGRAPHER",JLabel.CENTER); pane=new JTabbedPaneO; pane.setSize(500,700); pane.addTab("Embedding",new EmbedO); pane.addTab("Extracting",new ExtractO); add(mainlab,BorderLayout.NORTH); add(pane,BorderLayout.CENTER); } //Constructor Ends class ExtractListener implements ActionListener{ public void actionPerformed(ActionEvent ae){ if(ae.getActionCommandO.equals("extract")){ //perform Embedding here } //If endsALGORITHMS:LSB algorithm: Embedding in sender side 1. Start 2. Open two files, a bitmap file (source) and a message file. 3. find the text file size and embed it after 54 bytes. page 44
  51. 51. 4. Open a separate bitmap file (destination). 5. Take the first 54 bytes from the source bitmap image and write directly to the destination bitmap image. 6. Then embed the file size into it. 7. Take a byte from the bitmap image, and take a bit from the message byte and embed it into the least significant bit of the bitmap image. 8. Continue this till end of file for the message file. 9. Then write all the remaining bytes of bitmap image(source) directly to the destination bitmap image. 10. Stop Extraction in the receiver side 1. Start 2. Open the file which holds the embedded message(source). 3. Open a text file(incase of message text embedded). 4. Skip the first 54 bytes in the bitmap image as it holds only the header information 5. Then get the file size by uncovering the bits embedded in the LSB. 6. While file size not equal to 0 do 7. Uncover each and every bit of message from the LSB of the bitmap image and for every 8 bytes of bitmap image 1 byte of message will be stored. So at every retrieval of 1 byte of message write the byte in a text file. 8. Decrease the file size. 9. Loop this action 10. When file size reaches 0, quit the program 11. stopAlgorithm for SRM algorithm for steganography page 4S -- --
  52. 52. Embedding in the sender side1. Start2. Open two files a bitmap file (source) and a message file (text).3. The message should contain text.4. Find the message file size.5. Skip the first 54 bytes of the bitmap6. Open a target bitmap file7. Write the 54 bytes directly into it.8. Then embed the file size of the message file.9. Initialize a random number generator and give a seed value say x.10. A sequence of random numbers will be generated with value < x.11. Take that value and mod it with 8.12. The mod value is the bit position selected to embed the message bits.13. If the mod value is 0, then normal LSB is used.14. If the mod value is non zero then it should be embedded in any of the bits from Ito 7.15. There are two cases in embedding message in non LSB Case1: If the bit in the position selected and the message bit that should beembedded are same then (a) turn the value ofLSB to 0 (b) Dont make any changes in the selected position, assume that the bit is embedded as the values are same. Case2: If the bit in the positions elected and the message bit are unequal then (a) Change the value of the LSB to 1, indicating that the message bit value is NOT of the current bit value of that position. (b) Dont make any change in the bit of that position, assume that NOT of that bit value is stored as LSB is used as a flag. page 46
  53. 53. 16. Proceed this action until the end of file for the text file is detected.17. When end of file is detected, stop the process.Extraction in the receiver side1. Get the bitmap file where the message is embedded (source).2. Open a text file to write the message that would be extracted.3. Skip the first 54 bytes in the bitmap image.4. Extract the file size that is embedded after the header information.5. Store it in a variable.6. Until the file size reaches 0, do the following7. Generate the same random number series with the same seed value that is used during the embedding process.8. The same sequence of value will be generated.9. Mod the value with 8.10. Check the reminder11. If the reminder is 0, then the message bit is in LSB, uncover it.12. Then again check the number in the next sequence.13. Mod it again with 8.14. If the reminder is non 0, then check the LSB.15. If LSB is 0, then the bit in non zero position is taken and shifted accordingly to augment it to form a byte. 16. If LSB is not 0, then the NOT of bit in non-zeroth position is taken and attached accordingly to find the message bit. 17. It is done up to 8 bytes to find the exact message byte and then it is written in the text file. 18. Decrease the value of the file size. page 47
  54. 54. 19. Loop these actions. 20. When end of file is reached the program quits 21. Stop.SRM algorithm for Cryptography Encryption at the sender side: 1. Start 2. Get the file to be encrypted. 3. Enter the algoritlun selection key. 4. Enter the Encryption key. 5. Each and every digit of the algoritlun selection key is extracted and that corresponding algoritlun is chosen. 6. The encrypted file is fed as the input for the algoritlun represented by the next digit. 7. This is done until the last number in the key is found. 8. The encrypted file is then sent. 9. Stop Decryption at the receiver side: 1. Start 2. Get the encrypted file to decrypt. 3. Enter the same algoritlun selection key 4. Enter the same encryption key. page 48
  55. 55. 5. Each and every digit of the algorithm selection key is chosen in the reverse order and decrypted according to the algorithm represented by the digit.6. The decrypted file is fed as an input to the next algorithm represented by the next preceding digit for decryption.7. This is done until the first digit is reached.8. Check if the file is decrypted.9. StopNow let us see the algorithm of the 10 encryption/decryption algorithm used: ENCRYPTION ALGORITHMMain Algorithm:1.Get the algorithm selection key(asel) and the Random number generationinitializing key(Seed).2.0pen the file which has to be encrypted and store its contents in a byte array(arr[]).3.Take a character from the asel key and perform the corresponding algorithm on thebyte array (arr[]).EX: If the character is 9 perform the 10th algorithm. If the character is 5 perform the 6th algorithm. etc First Algorithm is the default algorithm.4.Continue with step 3 untill the last character of the asel key gets processed.(NOTE:In step 3 Operating on the same array provides pipelining i.e output of onealgorithm is given as page 49
  56. 56. input to the next algorithm.)Sub Algorithms:ALGORITHM -1:I.Increment the seed once.2.Initialize the Random number generator with the seed.3.start a loop (i= 0 to filesize-l) a. Get a Random number (ran) of range 0-7. b.Get a byte from the byte array(arr[]). c.Invert the (ran) th bit ,(ran+2)th bit and (ran+4)th bit of the byte.4.End loop(i).ALGORITHM-1 ENDSALGORITHM-2I.Increment the seed once.2. Initialize the Random number generator with seed.3.Get a random number(loop) which determines the number for times the followingloop has to executed.(range 0-7)4.Start a loop (j=0 to loop) 4.a. start a loop (i= 0 to filesize-l) 1. Get a Random number (ran) of range 0-7. page 50
  57. 57. 2.Get a byte from the byte array(arr[]). 3.Invert the (ran) th bit ,(ran+2)th bit and (ran+4)th bit of the byte. 4.b End loop(i).5.End loop(j)ALGORITHM-2 ENDSALGORITHM-3I.Increment the seed once.2. Initialize the Random number generator with seed.3.Get a random number(iteration) which determines the number for times thefollowing loop has to executed.(range 0-19)4.Start a loop (j=0 to iteration) 4.a. start a loop (i= 0 to filesize-l) 1. Get a Random number (ran) of range 0-7. 2.Get a byte from the byte array(arr[]). 3.Invert the (ran) th bit. 4.b End loop(i).5.End loop(j)ALGORITHM-3 ENDSALGORITHM-4 I.Increment the seed once. page 51
  58. 58. 2. Initialize the Random number generator with seed.3.start a loop (i= 0 to filesize-I) a. Get a Random number (ran) ofrange 0-7. b.Get a byte from the byte array(arr[]). c.Invert the (ran) th bit.4.End loop(i).ALGORITHM-4 ENDSALGORITHM-5I.Increment the seed once.2. Initialize the Random number generator with seed.3.Get a random number(iteration) which determines the number for times thefollowing loop has to executed.(range 0-19)4.Start a loop (j=0 to iteration) 4.a. start a loop (i= 0 to filesize-l) 1. Get a Random number (bitno) of range 0-7 which determines the number ofbits to be inverted. 2.Start a loop(k=Oto bitno) a.Get a Random number(ran) (range 0-7). b.Get a byte from the byte array(arr[]). c.Invert the (ran) th bit. 3.End loop (k). 4.b End Ioop(i). page 52
  59. 59. 5.End loop(j)ALGORITHM-5 ENDSALGORITHM-6I.Increment the seed once.2. Initialize the Random number generator with seed.3.start a loop (i= 0 to filesize-I) a. Get a Random number (ran) of range 0-7. b.Get a byte from the byte array(arr[]). c.If ran is 0 or I then invert the MSB of the byte. d.If ran is 2 or 3 then invert the LSB of the byte. e.If ran is 4,5,6 or 7 then l.Get the contents of the 6th and 5th bits. 2.Combine their values and store the in a variable(a). Ex: If 6th=0 and 5th=I then=1. If 6th=I and 5th=I then=3...etc. 3.Select the bit which is a+I no of positions away from 5th bit in a cyclicmanner such that it stays with in the inner 6bits range (i.e excluding MSB and the LSB). 4.Invert the selected bit.4.End loop(i).ALGORITHM-6 ENDSALGORITHM-7I.Increment the seed once. page 53
  60. 60. 2. Initialize the Random number generator with seed.3.start a loop (i= 0 to filesize-l) a. Get a Random number (ran) ofrange 0-7. b.Get a byte from the byte array(arr[]). c.If ran is 0 or 1 then invert the MSB of the byte. d.If ran is 2 or 3 then invert the LSB of the byte. e.Ifran is 4,5,6 or 7 then l.Get the contents ofthe 5th and 4th bits. 2.Combine their values and store the in a variable(a). Ex: If 5th=0 and 4th=1 then=l. If5th=1 and 4th=1 then=3...etc. 3.Select the bit which is a+l no of positions away from 4th bit in a cyclicmanner such that it stays with in the inner 6bits range (i.e excluding MSB and the LSB). 4.Invert the selected bit.4.End loop(i).ALGORITHM-7 ENDSALGORITHM-8 I.Increment the seed once. 2. Initialize the Random number generator with seed. 3.start a loop (i= 0 to filesize-l) a. Get a Random number (ran) of range 0-7. b.Get a byte from the byte array(arr[D. c.Ifran is 0 or 1 then invert the MSB of the byte. page 54
  61. 61. d.Ifran is 2 or 3 then invert the LSB of the byte. e.Ifran is 4,5,6 or 7 then l.Get the contents of the 4th and 3rd bits. 2.Combine their values and store the in a variable(a). Ex: If 4th=0 and 3rd=1 then=1. If 4th=1 and 3rd=1 then=3...etc. 3.Select the bit which is a+I no of positions away from 3rd bit in a cyclic manner such that it stays with in the inner 6bits range (i.e excluding MSB and the LSB). 4.Invert the selected bit. 4.End loop(i). ALGORITHM-8 ENDS ALGORITHM-9 I.Increment the seed once. 2. Initialize the Random number generator with seed. 3.start a loop (i= 0 to filesize-l) a. Get a Random number (ran) of range 0-7. b.Get a byte from the byte array(arr[]). c.If ran is 0 or 1 then invert the MSB of the byte. d.If ran is 2 or 3 then invert the LSB of the byte. e.If ran is 4,5,6 or 7 then l.Get the contents of the 3rd and 2nd bits. 2.Combine their values and store the in a variable(a). Ex: If3rd=0 and 2nd=1 then=1. If 3rd=1 and 2nd=1 then=3...etc. page 55--- -
  62. 62. 3.Select the bit which is a+ I no of positions away from 2nd bit in a cyclicmanner such that it stays with in the inner 6bits range (i.e excluding MSB and the LSB). 4.Invert the selected bit.4.End loop(i).ALGORITHM-9 ENDSALGORITHM-l 01.Increment the seed once.2. Initialize the Random number generator with seed.3.start a loop (i= 0 to filesize-1) a. Get a Random number (ran) of range 0-7. b.Get a byte from the byte array(arr[D. c.Ifran is 0 or 1 then invert the MSB of the byte. d.If ran is 2 or 3 then invert the LSB of the byte. e.Ifran is 4,5,6 or 7 then l.Get the contents of the 2nd and 1st bits. 2.Combine their values and store the in a variable(a). Ex: If2nd=0 and 1st=1 then=1. If2nd=1 and 1st=1 then=3...etc. 3.Se1ectthe bit which is a+l no of positions away from 1st bit in a cyclic manner such that it stays with in the inner 6bits range (i.e excluding MSB and the LSB). 4.Invert the selected bit. 4.End loop(i). ALGORITHM-IO ENDS page 56 ----
  63. 63. ENCRYPTION ALGORITHM ENDSDECRYPTION ALGORITHMMain Algorithm: Same as Encryption algorithm Except that I.asel key has to be reversed 2.asel keys length has to be added to the seed. before starting the algorithm.Sub Algorithms (1-10): Same as the Encryption algorithms Except that I.The first step of the algorithm should be decrementing the seed(notIncrementing as in Encrypting)DECRYPTION ALGORITHM ENDSNOTE:Incrementing and decrementing of the seed is done becauseif the asel key has repeated characters it might negate the effect of an algorithmSometimes this may result in unencrypted input file even after the encryption processIS over. page 57
  64. 64. PASSWORD AUTHENTICATION ALGORITHM 1. Start 2. Store the original password in an array 3. Prompt the user to type a password. 4. Keep the initial attempt as 3. 5. If user types the password, check ifit is the correct password. 6. If the password is correct, proceed to the next session. 7. If not, until the attempts become 0 request the user to type the password. 8. If attempts become 0, then 9. Create and open a log file. 10. Capture the system date and system time 11. Write it in the log file and also the wrong password. 12. Quit from the program 13. StopSRM ALGORITHM FOR DIGITAL WATERMARKINGIn this the same SRM algorithm for steganography is used. Apart from that, thefollowing is used. Watermarking at sender side: 1. Start page 58 --
  65. 65. 2. Embed the infonnation(senders name in this case) into the bitmap image after skipping the 54 bytes(header infonnation).3. Embed the encrypted message.4. Send to the receiver5. Stop Watermarking verification in the receiver side:1. The receiver will be prompted to enter the senders name2. The senders name from the bitmap will be stored in an array and the name that is typed by the receiver will also be checked along with that.3. If they are same then we will further go to the task of extracting.4. If not then an error message will occur specifying the input of wrong sender name.5. Stop.SYSTEM TESTING:Both UNIT and INTEGRATED testing are donefor this project. page 59
  66. 66. Let us see the sample data for LSB algorithmTwo inputs are given. One is the Bitmap image source.bmp and a message filesundar.txt.Then they are embedded and put in a separate bitmap image called Desti.bmp andthe extracted file name is Targfile.txt.Embedding:Source.BmpSundar.txt page 60
  67. 67. r::~"""".-=>I..tIIi ~.1"onn8t t18Ip h1d. 5und.,.? Ihow ,. u?Extracting:Desti.Bmp page 61
  68. 68. Targfile.txt ,.,.,"" ".m..., ,.,... E«PorM8t.... h1 d~ sundar?.IhOW,. u?SRM algorithm for Steganography:Embedding:Inputs: srm.bmp, text.txt page 62
  69. 69. Text.txt .=.J jtQ,;--;"n:..nrr-_ IV~~Xot6~ I" PMExtraction:Inputfile: Des.bmpOutputfile: Targfile.txt page 63
  70. 70. Targfile.txtSRM ALGORITHM FOR CRYPTOGRAPHYEncryption:Inputfile: Text.txtOutput file: En crypted.txtText.txt page 64
  71. 71. En crypted.txtDecryption:Inputfile: Encrypted.txtOutput file: Decrypted.txtEncrypted.txt - .. ~ J~.eo-.dgy...llc2~~ .~:.{i.fCS6-"1..~:53PM- page 65
  72. 72. decrypted. txt IJ1:1eo III!1_d...1 ~ ~...I ,--,,-SRM ALGORITHM FOR PASSWORD AUTHENTICATIONHere, we have given the output of the Logfile that will be generated as result ofinvalid password.Now we have the snapshot of the logfile.. . page 66
  73. 73. 2004 2 2 U 51 524 20042 2 U 51 5951 20042 2 . U 521 65 20042 2 U 523 191 00422 U 523 19 004 22 U 523 19 004 22 11 5330 74 J l€isteg~ay...II~U]f,fJLf.TX.. ~~4XO~~ 12:04~SRM ALGORITHM FOR DIGITAL MARKINGThere is no big difference between the message embedded and message watermarkedimage during a view. Both look same. page 67
  74. 74. ]ltputFile: Source.bmpOutputfile: Desti.BmpSource.bmpdesti.bmp page 68
  75. 75. SNAPSHOT OF OUR INTERFACEThe interface can be customized in two ways.1. With Encryption2. Without Encryption.With Encryption~.sRM StcS"S""pkw I!I!!!~ WELCOMETO S.lt M 5TEGANOGRAPHER ~ ,~~-~, = .EII".: ~.. . " ~-~:-:- = Elll:lwtberorelHllbeddinG1 .~.Yes:Q!!o Clnidfle: r--~~~~f IlL: ~I~~~~:.l IlL: r~~~~~~~1 IlL: EnlerRinlom noi1iL key: r~::~""~"u -~ Enter AIgoritIm Selection key: [~~~:-_.,.. -,- --- [~.~~,.lf-.--. - -- - - - ~ before ExtractiIg., CIned file: ~1!t ", .~. ,-,"_.~ NIL: ~!!i"MP . -- File: . Saw Extracted fie as : NIl: _.-~_ _=-"c~" .,,, Enter Random no./M. key: Enter AIgoritIm se/edion key: r~-_ "-- --_ .~:_~. __0. j ~.~.11 ... ~ ~ ,. . -~._,. --~-_. . --,-~.-~-~.-." . . page 69
  76. 76. Without Encryption&SAMStcgmgNphlr "1iJ E1 welCOME TO S.R.M STEGANOGRAPHER ::: Cwenfie: .. it.:~;~ NL: I~~~~:~l Nl: ~~tA1!~file~~:J Hi. Emrp.mnm.iU~: [==~_._"__ J ~rAl!IoIiIIm~mTref " o,~J~i}~1OO . L.___ Cwertfie: Save Exlractedfile as: ., - .,-".<" EnterRMdooI o.ill. key: n L SIltExlract" ,. I1g -.-. page 70
  77. 77. SAMPLE OUPUTS WHEN WRONG PASSWORD IS GIVEN WELCOMETO S.R.M STEGANOGRAPHER .....- ~ .",.~,. -~~ ~ = = -- ,ElaNd Ero)!t ef(feenieckilg? b ,~;yes@ ~ CIIJert fie: t~~ E:~~~ r~~i~: .~ E:~.1r_ 11. ,. ._. «- MeI!1 Ej, " I 1 CWeit ie: f r. _ ~.~-~~,;~"p """-,,.. . .ftOi _. _~~ ~ " ..,. l ~_.~ SawEJdrWdlieas: ~.~ 1 Erter inbnno.t key. R i E &:.:t " I ". ~~ExIr~.... ... "11I i ",, .. r.;. I page 71

×