isena/ISStego

语言: Objective-C

git: https://github.com/isena/ISStego

针对OS X和iOS的Steganography的Objective-C实现
Objective-C implementation of Steganography for OS X & iOS
README.md (中文)

ISStego

ISStego是适用于Mac OS X和iOS的Objective-C库,可用于使用隐写术的数字技术(通过默默无闻的安全形式)对图像进行编码和解码。

什么是隐写术?

隐写术来自希腊语steganos,意思是覆盖或保护,和graphein,意思是写作。基本上,这是将重要信息隐藏在不重要的对象中的做法。例如,我们可以在另一个消息,图像,音频或视频中隐藏消息。

见例子:

original Image Stego image
Pure image (without hidden information) Image with a steganographically hidden text (2198 characters).

[Steganography isEqualTo:Encryption]?

假。它们完全不同。

加密的主要建议是通过将普通信息(明文)转换为难以理解的文本(密文)来隐藏消息的含义。您可以检测某些内容是否已加密。

另一方面,隐写术隐藏了信息本身,大多数人都不会发现它的存在。

我们应该只使用隐写吗?

隐写术是一种安全形式,但并不是唯一的。除了隐写术之外,我们可以(并且我们建议使用)使用其他形式的安全性,例如加密。

也可以看看。

ISStego如何运作?

ISStego使用三种隐写技术:

  • 最低有效位(LSB):ISStego采用图像的每个像素的二进制表示,并使用CoreGraphics框架用信息位覆盖某些字节的LSB;
  • 顺序色彩循环(SCC):每个像素有四个字节的信息,涉及红色,绿色和蓝色(RGB)和通道alpha(透明度)。使用SCC,ISStego嵌入信息位,旋转颜色字节。
  • 均匀分布:信息位在整个图像中均匀分布。

安装

手册

将ISStego文件夹拖到项目中。

的CocoaPods

或者你可以使用CocoaPods。

pod 'ISStego'

例子

OS X.

ISStego OS X示例

exampleOSX

iOS版

ISStego iOS示例

exampleiOS

用法

导入ISSteganographer

#import "ISSteganographer.h"

iOS版

编码

NSString *encryptedPassword = @"47151d0e56f8dc";

UIImage *image  = [UIImage imageNamed:@"imageName"];

[ISSteganographer hideData:encryptedPassword
                 withImage:image
           completionBlock:^(id image, NSError *error) {
               if (error) {
                   NSLog(@"error: %@", error);
               } else {
                   [UIImagePNGRepresentation(image) writeToFile:@"PATH_OF_FILE"
                                                     atomically:YES];
               }
           }];

解码

UIImage *image  = [UIImage imageNamed:@"stegoImageName"];

[ISSteganographer dataFromImage:image
                completionBlock:^(NSData *data, NSError *error) {
                    if (error) {
                        NSLog(@"error: %@", error);
                    } else {
                        NSString *hiddenData = [[NSString alloc] initWithData:data
                                                                     encoding:NSUTF8StringEncoding];
                        NSLog(@"string: %@", hiddenData);
                    }
                }];

Mac OS X.

编码

NSString *encryptedPassword = @"47151d0e56f8dc";

NSImage *image  = [NSImage imageNamed:@"imageName"];

[ISSteganographer hideData:encryptedPassword
                 withImage:image
           completionBlock:^(id image, NSError *error) {
               if (error) {
                   NSLog(@"error: %@", error);
               } else {
                   CGImageRef cgRef = [image CGImageForProposedRect:NULL
                                                            context:nil
                                                              hints:nil];

                   NSBitmapImageRep *bitmapImage = [[NSBitmapImageRep alloc] initWithCGImage:cgRef];

                   [bitmapImage setSize:[image size]];

                   NSData *pngData = [bitmapImage representationUsingType:NSPNGFileType
                                                          properties:nil];

                   [pngData writeToFile:@"PATH_OF_FILE"
                             atomically:YES];

                   bitmapImage = nil;
               }
           }];

解码

NSImage *image  = [NSImage imageNamed:@"stegoImageName"];

[ISSteganographer dataFromImage:image
                completionBlock:^(NSData *data, NSError *error) {
                    if (error) {
                        NSLog(@"error: %@", error);
                    } else {
                        NSString *hiddenData = [[NSString alloc] initWithData:data
                                                                     encoding:NSUTF8StringEncoding];
                        NSLog(@"string: %@", hiddenData);
                    }
                }];

作者

Isaac Steve Sena,@ Isaac Stevens Seena

执照

ISStego根据MIT许可证发布。看到 LICENSE.md。

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

ISStego

ISStego is an Objective-C library for Mac OS X & iOS that can be used to encode and decode secret data with images using digital techniques of steganography, a form of security through obscurity.

What is Steganography?

Steganography comes from the Greek words steganos, meaning covered or protected, and graphein, meaning writing. Basically it is the practice of hiding important information within a unimportant object. For instance we can hide a message within another message, image, audio or video.

See example:

original Image Stego image
Pure image (without hidden information) Image with a steganographically hidden text (2198 characters).

[Steganography isEqualTo:Encryption]?

FALSE. They are completely different.

The main propose of encryption is to hide the meaning of the message by converting ordinary information (plaintext) into unintelligible text (ciphertext). You can detect if something has been encrypted.

On the other hand, steganography hides the information itself and most people would not detect its presence.

Should we use only steganography?

Steganography is a form of security but it is not unique. We can (and we recommend using) use other forms of security, such as encryption, in addition to steganography.

See also.

How does ISStego work?

ISStego uses three steganography techniques:

  • Least Significant Bit (LSB): ISStego takes the binary representation of each pixel of image and overwrites the LSB of some bytes with the bits of information using CoreGraphics framework;
  • Sequential Colour Cycle (SCC): Each pixel has four bytes of information regarding the colors red, green and blue (RGB) and the channel alpha (transparency). With SCC, ISStego embeds the bits of information, rotating the colour bytes.
  • Uniform Distribution: The bits of information are distributed uniformly throughout the image.

Installation

Manual

Drag the ISStego folder into your project.

CocoaPods

Or you can use CocoaPods.

pod 'ISStego'

Examples

OS X

ISStego OS X Example

exampleOSX

iOS

ISStego iOS Example

exampleiOS

Usage

Import ISSteganographer

#import "ISSteganographer.h"

iOS

Encode

NSString *encryptedPassword = @"47151d0e56f8dc";

UIImage *image  = [UIImage imageNamed:@"imageName"];

[ISSteganographer hideData:encryptedPassword
                 withImage:image
           completionBlock:^(id image, NSError *error) {
               if (error) {
                   NSLog(@"error: %@", error);
               } else {
                   [UIImagePNGRepresentation(image) writeToFile:@"PATH_OF_FILE"
                                                     atomically:YES];
               }
           }];

Decode

UIImage *image  = [UIImage imageNamed:@"stegoImageName"];

[ISSteganographer dataFromImage:image
                completionBlock:^(NSData *data, NSError *error) {
                    if (error) {
                        NSLog(@"error: %@", error);
                    } else {
                        NSString *hiddenData = [[NSString alloc] initWithData:data
                                                                     encoding:NSUTF8StringEncoding];
                        NSLog(@"string: %@", hiddenData);
                    }
                }];

Mac OS X

Encode

NSString *encryptedPassword = @"47151d0e56f8dc";

NSImage *image  = [NSImage imageNamed:@"imageName"];

[ISSteganographer hideData:encryptedPassword
                 withImage:image
           completionBlock:^(id image, NSError *error) {
               if (error) {
                   NSLog(@"error: %@", error);
               } else {
                   CGImageRef cgRef = [image CGImageForProposedRect:NULL
                                                            context:nil
                                                              hints:nil];

                   NSBitmapImageRep *bitmapImage = [[NSBitmapImageRep alloc] initWithCGImage:cgRef];

                   [bitmapImage setSize:[image size]];

                   NSData *pngData = [bitmapImage representationUsingType:NSPNGFileType
                                                          properties:nil];

                   [pngData writeToFile:@"PATH_OF_FILE"
                             atomically:YES];

                   bitmapImage = nil;
               }
           }];

Decode

NSImage *image  = [NSImage imageNamed:@"stegoImageName"];

[ISSteganographer dataFromImage:image
                completionBlock:^(NSData *data, NSError *error) {
                    if (error) {
                        NSLog(@"error: %@", error);
                    } else {
                        NSString *hiddenData = [[NSString alloc] initWithData:data
                                                                     encoding:NSUTF8StringEncoding];
                        NSLog(@"string: %@", hiddenData);
                    }
                }];

Author

Isaac Stevao Sena, @IsaacStevaoSena

License

ISStego is released under the MIT license. See
LICENSE.md.