var jCrypto = function(){};

const crypto = require('crypto')

jCrypto.prototype.ConfirmCryptoEnabled()
{
	try{
		var crypto = require('crypto');
		return true;
	} catch (e){
		alert('Crypto support is disabled!');
		console.log('Crypto suppose disabled.', e.Stack)
		return false;
	}
}

jCrypto.prototype.encrypt(contents, password)
{
	// Pseudo PGP Scheme

	// hash+salt password
	var passwordCipher = crypto.createCipher('sha256','Is it Secret? Is it Safe?');
	var sPassword = contentCipher.update(password,'utf8','base64');
	sPassword += contentCipher.final('base64');

	// generate random key
	var rKey = crypto.randomBytes(256).toString('base64');

	// encrypt contents with random key.
	var contentCipher = crypto.createCipher('sha256',rKey);
	var eContents = contentCipher.update(contents,'utf8','base64');
	eContents += contentCipher.final('base64');

	// encrypt random key with saltPassword.
	var keyCipher = crypto.createCipher('sha256',sPassword);
	var eKey = keyCipher.update(rKey,'utf8','base64');
	eKey += keyCipher.final('base64');
	
	// combine eKey and eContents;
	var output = eKey + '_JAETE_'+eContents;

	return output;
}

jCrypto.prototype.decrypt(contents, password)
{
	// Pseudo PGP Scheme

	// hash+salt password
	var passwordCipher = crypto.createCipher('sha256','Is it Secret? Is it Safe?');
	var sPassword = contentCipher.update(password,'utf8','base64');
	sPassword += contentCipher.final('base64');

	// split eKey and eContents
	var arr = contents.split('_JAETE_');
	var eKey = arr[0];
	var eContents = arr[1];

	// decrypt eKey with saltPassword.
	var keyDecipher = crypto.createDecipher('sha256',sPassword);
	var rKey = keyDecipher.update(eKey,'base64','utf8');
	rKey += keyDecipher.final('utf8');

	// decrypt eContents with dKey.
	var contentDecipher = crypto.createDecipher('sha256',rKey);
	var contents = contentDecipher.update(eContents,'base64','utf8');
	contents += contentDecipher.final('utf8');

	return contents;
}

exports.jCrypto = jCrypto;
// should probably add this to start-up:
//let crypto;
//try {
 // crypto = require('crypto');
//} catch (err) {
//  console.log('crypto support is disabled!');
//}

@@ -98,16 +98,27 @@
 oEnabled
+ = function
 ()%0D%0A%7B%0D%0A%09
@@ -120,16 +120,19 @@
 %0A%7B%0D%0A%09try
+%0D%0A%09
 %7B%0D%0A%09%09var
@@ -332,24 +332,35 @@
 type.encrypt
+ = function
 (contents, p
@@ -1104,17 +1104,16 @@
 e64');%0D%0A
-%09
 %0D%0A%09// co
@@ -1231,16 +1231,27 @@
 .decrypt
+ = function
 (content

Fix jCrypto Module