Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elliotwoods/ofxWatermark
Watermark your app with a secured image (e.g. if sending to client). App will not open if image has been tampered with
https://github.com/elliotwoods/ofxWatermark
Last synced: 5 days ago
JSON representation
Watermark your app with a secured image (e.g. if sending to client). App will not open if image has been tampered with
- Host: GitHub
- URL: https://github.com/elliotwoods/ofxWatermark
- Owner: elliotwoods
- Created: 2014-04-16T08:00:24.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-05-21T14:59:05.000Z (over 10 years ago)
- Last Synced: 2024-08-02T17:35:50.818Z (3 months ago)
- Language: C++
- Size: 156 KB
- Stars: 18
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# ofxWatermark
## Introduction
Add a watermark to your application which cannot be changed after you build the app. If the image file is changed, the app will fail to run (give a system alert and quit).
## License
[MIT license](http://opensource.org/licenses/MIT), no warranty
## Usage
### Get the hash
In terminal, navigate to the image which you want to find the hash for, and do the following:
```bash
% md5 ./logo_white.png
MD5 (./logo_white.png) = 90c6b3efdead156592bf17985d0b6b58
```
This hash is 128 bits long. It is extermely difficult for somebody to replace the watermark image with a different image, whilst keeping the hash the same. This means that our program can simply check to make sure that the image which it is loading has the same hash as the one hardcoded into the program.### Code
In your cpp file:
```cpp
testApp::setup() {
...
watermark.init("logo_white.png", "90c6b3efdead156592bf17985d0b6b58");...
}testApp::draw() {
...watermark.draw(); //draws in bottom right
// or
watermark.draw(10, 10); // watermark also inherits ofImage
}
```In your h file:
```cpp
#include "ofxWatermark.h"class testApp : public ofApp {
...ofxWatermark watermark;
}
```### Other notes
If you're on osx, you probably want to copy the image into your app package, and change your data folder to match, e.g.:
add this to your 'Run script' in Target>Build Phases
```
cp -r ./bin/data/*.png "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources"
```and add this to the top of your setup function:
```cpp
ofSetDataPathRoot("../Resources/");
```