Skip to content

Instantly share code, notes, and snippets.

@noru
Forked from artsobolev/Stego.js
Created December 21, 2016 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noru/b0b61f9792fd3a230edd61a6aaf0c3a8 to your computer and use it in GitHub Desktop.
Save noru/b0b61f9792fd3a230edd61a6aaf0c3a8 to your computer and use it in GitHub Desktop.
var revealJS = function(s) {
var hexAlphabet = Array.apply(null, {
length: 10
}).map(Number.call, Number).concat('abcdef'.split(''));
var codes = [8289, 8204, 8205, 8206, 8207, 8234, 8235, 8236, 8237, 8238, 8298, 8299, 8300, 8301, 8302, 8303];
return s.match(/(.{4})/g).map(function(b) {
return b.split('').map(function(i) {
return hexAlphabet[codes.indexOf(i.charCodeAt())]
})
}).map(function(c) {
return String.fromCharCode(0 + "x" + c.join(''))
}).join('')
}
var invisibleJS = function(s) {
return s.replace(/./g, function(b) {
var code = '0000' + b.charCodeAt().toString(16);
code = code.substring(code.length - 4);
return String.fromCharCode.apply(String, code.split('').map(function(a) {
hexAlphabet = Array.apply(null, {
length: 10
}).map(Number.call, Number).map(function(n) {
return n.toString();
}).concat('abcdef'.split(''));
codes = [8289, 8204, 8205, 8206, 8207, 8234, 8235, 8236, 8237, 8238, 8298, 8299, 8300, 8301, 8302, 8303];
var idx = hexAlphabet.indexOf(a);
return codes[idx]
}))
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment