<commit_before>var crypto = require('crypto'),
	pull = require('pull-stream'),
	bops = require('bops')


exports.encoder = function cryptoStreamEncode(opts) {
	if (!opts.password) throw new Error("Must supply password")
	if (!opts.encrypt) opts.encrypt = {}
	if (!opts.decrypt) opts.decrypt = {}
	var alg = opts.algorithm || 'aes-256-cbc'
	var ine = (opts.encrypt.inputEncoding === undefined ? 'utf8' : opts.encrypt.inputEncoding)
	var enc = (opts.encrypt.encoding === undefined ? 'hex' : opts.encrypt.encoding)
	var cipher = crypto.createCipher(alg, opts.password)
	var cipherTxt = '';
	var encode = pull.Through(function (read) {
		var sent = false;
		return function (end, cb) {
			read(end, function next(end, data) {
				if (end === true && sent === false) {
					sent = true;
					try {
						cipherTxt += cipher.final(enc)
					} catch(e) {
						cb(e)
					}
					cb(false, cipherTxt)
				} else if (end === true && sent === true) {
					cb(true)
				} else if (data !== null) {
					try {
						cipherTxt += cipher.update(data, ine, enc)
					} catch(e) {
						cb(e)
					}
					read(end, next)
				}
			})
		}
	})
	return encode()

}

exports.decoder = function cryptoStreamDecode(opts) {
	if (!opts.password) throw new Error("Must supply password")
	var alg = opts.algorithm || 'aes-256-cbc'
	var ine = (opts.decrypt.inputEncoding === undefined ? 'hex' : opts.decrypt.inputEncoding)
	var enc = (opts.decrypt.encoding === undefined ? 'utf8' : opts.decrypt.encoding)
	var decipher = crypto.createDecipher(alg, opts.password)
	var plainTxt = '';
	var decode = pull.Through(function (read) {
		var sent = false;
		return function (end, cb) {
			read(end, function next(end, data) {
				if (end === true && sent === false) {
					sent = true;
					try {
						plainTxt += decipher.final(enc)
					} catch(e) {
						cb(e)
					}
					cb(false, plainTxt)
				} else if (end === true && sent === true) {
					cb(true)
				} else if (data !== null) {
					try {
						plainTxt += decipher.update(data, ine, enc)
					} catch(e) {<commit_msg>removed opts check for decrypt inside of encrypt function, and removed check for encrypt opts inside decrypt function.<commit_after>var crypto = require('crypto'),
	pull = require('pull-stream'),
	bops = require('bops')


exports.encoder = function cryptoStreamEncode(opts) {
	if (!opts.password) throw new Error("Must supply password")
	if (!opts.encrypt) opts.encrypt = {}
	var alg = opts.algorithm || 'aes-256-cbc'
	var ine = (opts.encrypt.inputEncoding === undefined ? 'utf8' : opts.encrypt.inputEncoding)
	var enc = (opts.encrypt.encoding === undefined ? 'hex' : opts.encrypt.encoding)
	var cipher = crypto.createCipher(alg, opts.password)
	var cipherTxt = '';
	var encode = pull.Through(function (read) {
		var sent = false;
		return function (end, cb) {
			read(end, function next(end, data) {
				if (end === true && sent === false) {
					sent = true;
					try {
						cipherTxt += cipher.final(enc)
					} catch(e) {
						cb(e)
					}
					cb(false, cipherTxt)
				} else if (end === true && sent === true) {
					cb(true)
				} else if (data !== null) {
					try {
						cipherTxt += cipher.update(data, ine, enc)
					} catch(e) {
						cb(e)
					}
					read(end, next)
				}
			})
		}
	})
	return encode()

}

exports.decoder = function cryptoStreamDecode(opts) {
	if (!opts.password) throw new Error("Must supply password")
	if (!opts.decrypt) opts.decrypt = {}
	var alg = opts.algorithm || 'aes-256-cbc'
	var ine = (opts.decrypt.inputEncoding === undefined ? 'hex' : opts.decrypt.inputEncoding)
	var enc = (opts.decrypt.encoding === undefined ? 'utf8' : opts.decrypt.encoding)
	var decipher = crypto.createDecipher(alg, opts.password)
	var plainTxt = '';
	var decode = pull.Through(function (read) {
		var sent = false;
		return function (end, cb) {
			read(end, function next(end, data) {
				if (end === true && sent === false) {
					sent = true;
					try {
						plainTxt += decipher.final(enc)
					} catch(e) {
						cb(e)
					}
					cb(false, plainTxt)
				} else if (end === true && sent === true) {
					cb(true)
				} else if (data !== null) {
					try {
						plainTxt += decipher.update(data, ine, enc)
					} catch(e) {
{'fraction_non_alphanumeric': 0.15780691299165672, 'fraction_numerical': 0.0038140643623361145, 'mean_word_length': 3.0076408787010505, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6047194', 'n_tokens_mistral': 1729, 'n_tokens_neox': 1415, 'n_words': 365}