https://github.com/richfitz/stegasaur
:sauropod: Steganography for R
https://github.com/richfitz/stegasaur
Last synced: over 1 year ago
JSON representation
:sauropod: Steganography for R
- Host: GitHub
- URL: https://github.com/richfitz/stegasaur
- Owner: richfitz
- Created: 2015-06-13T08:57:11.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2021-02-08T15:58:33.000Z (over 5 years ago)
- Last Synced: 2025-03-01T09:07:53.721Z (over 1 year ago)
- Language: R
- Homepage: https://richfitz.github.io/stegasaur/
- Size: 145 KB
- Stars: 33
- Watchers: 5
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# stegasaur
[](https://www.repostatus.org/#wip)
[](https://github.com/richfitz/stegasaur/actions)
[](https://codecov.io/github/richfitz/stegasaur?branch=master)
[](https://www.codefactor.io/repository/github/richfitz/stegasaur)

Steganography for R

The aim is to be able to encode arbitrary R objects in cat pictures:
```r
txt <- "this is a secret message"
kitten <- stegasaur::kitten(200, 300)
stegasaur::encode("this is a secret message", kitten, "kitten.png")
```
The file `kitten.png` in the working directory now contains both an adorable kitten and a secret message. The message can be decoded:
```r
stegasaur::decode("kitten.png")
# [1] "this is a secret message"
```
This works with arbitrary objects, too
```r
x <- runif(10)
stegasaur::encode(x, kitten, "kitten.png")
stegasaur::decode("kitten.png")
# [1] 0.8257649 0.2250323 0.1598864 0.4999668 0.6165416 0.6676501 0.8632083
# [8] 0.6462997 0.1772859 0.2864177
```
An additional helper function allows quick encoding in images, when one would like to encode the plot code with the figure:
```{r}
stegasaur::figasaur({plot(sample(100))}, "randomplot.png")
```
A [`knitr`](https://yihui.name/knitr/) "hook" (`hook_figasaur`) is also included, so one may automatically encode the generating code with plots throughout a `knitr` document. See `knitr_example.Rmd` in the `inst` directory for an example.