-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstegosaurus.js
98 lines (73 loc) · 3.25 KB
/
stegosaurus.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#! /usr/bin/env node
// ------------------------------------------------------------------------------------------------------------------------ -
/*
________ _________ _______ ________ ________ ________ ________ ___ ___ ________ ___ ___ ________
|\ ____\|\___ ___\\ ___ \ |\ ____\|\ __ \|\ ____\|\ __ \|\ \|\ \|\ __ \|\ \|\ \|\ ____\
\ \ \___|\|___ \ \_\ \ __/|\ \ \___|\ \ \|\ \ \ \___|\ \ \|\ \ \ \\\ \ \ \|\ \ \ \\\ \ \ \___|_
\ \_____ \ \ \ \ \ \ \_|/_\ \ \ __\ \ \\\ \ \_____ \ \ __ \ \ \\\ \ \ _ _\ \ \\\ \ \_____ \
\|____|\ \ \ \ \ \ \ \_|\ \ \ \|\ \ \ \\\ \|____|\ \ \ \ \ \ \ \\\ \ \ \\ \\ \ \\\ \|____|\ \
____\_\ \ \ \__\ \ \_______\ \_______\ \_______\____\_\ \ \__\ \__\ \_______\ \__\\ _\\ \_______\____\_\ \
|\_________\ \|__| \|_______|\|_______|\|_______|\_________\|__|\|__|\|_______|\|__|\|__|\|_______|\_________\
\|_________| \|_________| \|_________|
*/
// ------------------------------------------------------------------------------------------------------------------------ -
// A (quickly made) steganographic device to hide information in images.
// Created by Doug Smith, July 2014 ([email protected])
// Licensed under the MIT license, see license.txt
// ------------------------------------------------------------------------------------------------------------------------ -
// What you're looking at is the setup, and the public methods.
// Inside library/Stegosaurus.js you'll find the logic / private methods.
// ------------------------------------------------------------------------------------------------------------------------ -
// Constants module (w/ general configs)
// Currently, not really used. But, in case I need it later.
var constants = require("./includes/constants.js");
// Setup our primary library module, which we'll handle in our exports here.
var Stegosaurus = require("./library/Stegosaurus.js");
var stegosaurus = new Stegosaurus();
// Encode a PNG image, given a message file.
exports.encodeFile = function(infile,outfile,message,callback) {
if (typeof callback == 'undefined') {
callback = function(){};
}
var sendoptions = {
encode: true,
decode: false,
target: infile,
outfile: outfile,
inputmessagefile: message,
}
stegosaurus.handler(sendoptions,function(err){
callback(err);
});
}
// Encode a PNG image, given a string.
exports.encodeString = function(infile,outfile,messagestring,callback) {
if (typeof callback == 'undefined') {
callback = function(){};
}
var sendoptions = {
encode: true,
decode: false,
target: infile,
outfile: outfile,
message: messagestring,
}
stegosaurus.handler(sendoptions,function(err){
callback(err);
});
}
// Encode a message
exports.decode = function(infile,length_in_bytes,callback) {
if (typeof callback == 'undefined') {
callback = function(){};
}
var sendoptions = {
encode: false,
decode: true,
target: infile,
size: length_in_bytes,
}
stegosaurus.handler(sendoptions,function(payload){
callback(payload);
});
}