Skip to content

Commit

Permalink
Adding files
Browse files Browse the repository at this point in the history
  • Loading branch information
maierfelix committed Feb 15, 2015
1 parent 758f4ef commit ac8863a
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
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
7 changes: 7 additions & 0 deletions index.html
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>
59 changes: 59 additions & 0 deletions script.js
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);

0 comments on commit ac8863a

Please sign in to comment.