-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
758f4ef
commit ac8863a
Showing
3 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
# JS2PNG | ||
Hide Javascript into PNG images | ||
Experimental tool to hide javascript code into png images.<br/> | ||
Features: | ||
- Write Javascript code into PNG files | ||
- Read javascript from PNG images. | ||
|
||
Port of https://github.com/iamcal/PNGStore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<html> | ||
<head> | ||
<script type="text/javascript" src="script.js"></script> | ||
</head> | ||
<body> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
(function() { 'use strict' | ||
|
||
var root = this; | ||
|
||
var JS2PNG = JS2PNG || {}; | ||
|
||
var OUTPUT_FILTERED = 0, | ||
OUTPUT_8BIT = 1, | ||
OUTPUT_8BIT_GRAY = 1, | ||
OUTPUT_24BIT = 1, | ||
OUTPUT_32BIT = 1; | ||
|
||
var BYTE_STORE = {}; | ||
|
||
JS2PNG.Encode = function() { | ||
|
||
var data = arguments[0], | ||
prefix = arguments[1] || "undefined", | ||
size = data.length; | ||
|
||
for (var ii = 0, bytes = []; ii < size; ++ii) { | ||
bytes.push(data.charCodeAt(ii)); | ||
} | ||
|
||
BYTE_STORE[prefix + "_ascii"] = bytes; | ||
|
||
bytes = []; | ||
|
||
var sequences = Math.ceil((data.length) / 8); | ||
|
||
var cObj = { | ||
c1: "", | ||
c2: "", | ||
c3: "", | ||
c4: "", | ||
c5: "", | ||
c6: "", | ||
c7: "", | ||
c8: "" | ||
}; | ||
|
||
for (var ii = 0; ii < sequences; ++ii) { | ||
cObj.c1 += data.substr( (ii * 8) + 0, 1); | ||
cObj.c2 += data.substr( (ii * 8) + 1, 1); | ||
cObj.c3 += data.substr( (ii * 8) + 2, 1); | ||
cObj.c4 += data.substr( (ii * 8) + 3, 1); | ||
cObj.c5 += data.substr( (ii * 8) + 4, 1); | ||
cObj.c6 += data.substr( (ii * 8) + 5, 1); | ||
cObj.c7 += data.substr( (ii * 8) + 6, 1); | ||
cObj.c8 += data.substr( (ii * 8) + 7, 1); | ||
} | ||
|
||
}; | ||
|
||
JS2PNG.Encode("HelloWorld", "Filename"); | ||
|
||
root.JS2PNG = JS2PNG; | ||
|
||
}).call(this); |