# @mrdesjardins/steganography

> Basic Steganography library that add text into an image

Latest version **0.0.9** (published 2023-01-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mrdesjardins/steganography
pnpm add @mrdesjardins/steganography
yarn add @mrdesjardins/steganography
bun add @mrdesjardins/steganography
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2023-01-25 |
| First published | 2022-12-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 19 |
| Unpacked size | 17.7 KB |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Patrick Desjardins |
| Maintainers | mrdesjardins |

## Links

- npm: https://www.npmjs.com/package/@mrdesjardins/steganography
- Repository: https://github.com/MrDesjardins/steganographyts
- Homepage: https://github.com/MrDesjardins/steganographyts.git#readme
- Issues: https://github.com/MrDesjardins/steganographyts.git/issues
- npm.io page: https://npm.io/package/@mrdesjardins/steganography

## Dependencies (19)

- [jest](https://npm.io/package/jest.md) ^29.3.1
- [tsup](https://npm.io/package/tsup.md) ^6.5.0
- [sharp](https://npm.io/package/sharp.md) ^0.31.2
- [eslint](https://npm.io/package/eslint.md) ^8.30.0
- [ts-jest](https://npm.io/package/ts-jest.md) ^29.0.3
- [ts-node](https://npm.io/package/ts-node.md) ^10.9.1
- [benchmark](https://npm.io/package/benchmark.md) ^2.1.4
- [crypto-js](https://npm.io/package/crypto-js.md) ^4.1.1
- [typescript](https://npm.io/package/typescript.md) ^4.9.4
- [@types/jest](https://npm.io/package/@types/jest.md) ^29.2.4
- [lorem-ipsum](https://npm.io/package/lorem-ipsum.md) ^2.0.8
- [eslint-plugin-node](https://npm.io/package/eslint-plugin-node.md) ^11.1.0
- [eslint-plugin-import](https://npm.io/package/eslint-plugin-import.md) ^2.26.0
- [eslint-plugin-promise](https://npm.io/package/eslint-plugin-promise.md) ^6.1.1
- [eslint-config-prettier](https://npm.io/package/eslint-config-prettier.md) ^8.5.0
- [eslint-config-standard](https://npm.io/package/eslint-config-standard.md) ^17.0.0
- [eslint-plugin-prettier](https://npm.io/package/eslint-plugin-prettier.md) ^4.2.1
- [@typescript-eslint/parser](https://npm.io/package/@typescript-eslint/parser.md) ^5.46.1
- [@typescript-eslint/eslint-plugin](https://npm.io/package/@typescript-eslint/eslint-plugin.md) ^5.46.1

## Recent versions

- 0.0.9 (latest) — 2023-01-25
- 0.0.8 — 2023-01-12
- 0.0.7 — 2023-01-10
- 0.0.6 — 2022-12-21
- 0.0.5 — 2022-12-21
- 0.0.4 — 2022-12-21
- 0.0.3 — 2022-12-21
- 0.0.2 — 2022-12-21
- 0.0.1 — 2022-12-20

## README

[![Build, Test and Coverage](https://github.com/MrDesjardins/steganographyts/actions/workflows/action.yml/badge.svg?branch=master)](https://github.com/MrDesjardins/steganographyts/actions/workflows/action.yml)
[![codecov](https://codecov.io/gh/MrDesjardins/steganographyts/branch/master/graph/badge.svg?token=0HGGX9Z9OW)](https://codecov.io/gh/MrDesjardins/steganographyts)
[![](https://img.shields.io/badge/Benchmark-%E2%9C%85-brightgreen)](https://mrdesjardins.github.io/steganographyts/dev/bench/)
![ESNext Target](https://img.shields.io/badge/Target-ESNEXT-brightgreen.svg?style=plastic)
![CommonJs Target](https://img.shields.io/badge/Target-CommonJS-brightgreen?style=plastic)
![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=plastic&logo=typescript&logoColor=white)
[![](https://img.shields.io/npm/v/@mrdesjardins/steganography?style=plastic)](https://www.npmjs.com/package/@mrdesjardins/steganography)

# Steganography TypeScript

Embeded a string into an existing image.

# What is Steganography?

[Wikipedia](https://en.wikipedia.org/wiki/Steganography) defines steganography:

> the practice of representing information within another message or physical objec

This library uses a known technic which is to hide the bytes of the message into the bytes of the color.

More information in this [blog article](https://patrickdesjardins.com/blog/what-is-steganography-how-to-hide-text-in-image) about how I implemented the Steganography in this library.

You can find a [Rust Steganography](https://github.com/MrDesjardins/steganographyrs) implementation on Github.

This library relies on the least significant bits.

# What is Least Significant Bits?

1. [Blog Post about using the least significant bits](https://patrickdesjardins.com/blog/what-is-steganography-how-to-hide-text-in-image)

# How to Use the Library

## How to install the Steganography TypeScript Library

```sh
npm install --save steganographyts
```

## How to add a string into an image

```typescript
await addMessageToImage("Your message", "./yourimage.png", "./imagewithmessage.png");
```

## How to add a string into an image with the string encrypted

```typescript
await addMessageToImage("Your message", "./yourimage.png", "./imagewithmessage.png", {
  password: "Your password here",
});
```

## How to extract the string from an image

```typescript
const message = await getMessageFromImage("./imagewithmessage.png");
```

## How to extract an encrypted string from an image

```typescript
const message = await getMessageFromImage("./imagewithmessage.png", {
  password: "Your password here",
});
```

# Information for Developer

## Build

The build produces a EcmaScript Module and a CommonJS Module into the `dist` folder. The TypeScript map is generated in both target.

## Test

```sh
npm run test
```

## Debug

There is a VsCode Launch to debug the unit test. However, if you are running on Windows, you need to ensure you install `npm install` on the Windows machine using Powershell and not WSL as the Sharp library install different packages depending if it runs on WSL or Powershell.

# How is the Steganography TypeScript working?

If you want to get further detail about how the deta is injected into the image using this library you can follow this [blog post](https://patrickdesjardins.com/blog).

---
_Source: https://npm.io/package/@mrdesjardins/steganography · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
