<commit_before>var seed = Math.seedrandom();

var p = 
"FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1" +
"29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD" +
"EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245" +
"E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED" +
"EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE45B3D" +
"C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8 FD24CF5F" +
"83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D" +
"670C354E 4ABC9804 F1746C08 CA18217C 32905E46 2E36CE3B" +
"E39E772C 180E8603 9B2783A2 EC07A28F B5C55DF0 6F4C52C9" +
"DE2BCBF6 95581718 3995497C EA956AE5 15D22618 98FA0510" +
"15728E5A 8AAAC42D AD33170D 04507A33 A85521AB DF1CBA64" +
"ECFB8504 58DBEF0A 8AEA7157 5D060C7D B3970F85 A6E1E4C7" +
"ABF5AE8C DB0933D7 1E8C94E0 4A25619D CEE3D226 1AD2EE6B" +
"F12FFA06 D98A0864 D8760273 3EC86A64 521F2B18 177B200C" +
"BBE11757 7A615D6C 770988C0 BAD946E2 08E24FA0 74E5AB31" +
"43DB5BFC E0FD108E 4B82D120 A9210801 1A723C12 A787E6D7" +
"88719A10 BDBA5B26 99C32718 6AF4E23C 1A946834 B6150BDA" +
"2583E9CA 2AD44CE8 DBBBC2DB 04DE8EF9 2E8EFC14 1FBECAA6" +
"287C5947 4E6BC05D 99B2964F A090C3A2 233BA186 515BE7ED" +
"1F612970 CEE2D7AF B81BDD76 2170481C D0069127 D5B05AA9" +
"93B4EA98 8D8FDDC1 86FFB7DC 90A6C08F 4DF435C9 34063199" +
"FFFFFFFF FFFFFFFF";

var p = str2bigInt(p.replace(/\s/g, ''), 16);
var g = str2bigInt("2", 10);
var z = []; for (var i=0; i!==274; i++) { z[i] = 0; } z[272] = 1;

var num = sound = pos = tag = prikey = pubkey = last = 0;
var cfocus = true;
var soundEmbed = null;
var nick = $("#nick").html();
var name = $("#name").html();
var seq_s = [];
var seq_r = [];
var keys = [];
var names = [];
var queue = [];
var seckeys = [];
var usedhmac = [];
var inblocked = [];
var outblocked = [];
var fingerprints = [];

var notice = [
"Cryptocat is supported by people like you. Check out our <a href=\"https://crypto.cat/donate/\" target=\"_blank\">fundraiser</a> and keep us going.",
"Help Cryptocat become better - please <a href=\"https://crypto.cat/donate/\" target=\"_blank\">donate</a> by buying Cryptocat stickers!",
"Cryptocat is an open software effort. Your <a href=\"https://crypto.cat/donate/\" target=\"_blank\">donations</a> help us improve.",
"You can donate to Cryptocat using Bitcoin! Please <a href=\"https://crypto.cat/donate/\" target=\"_blank\">contribute</a> and keep us going.",
"Cryptocat is volunteer-run and handles thousands of conversations a week. Please <a href=\"https://crypto.cat/donate/\" target=\"_blank\">donate</a> today."
];

function scrolldown() {
	$("#chat").animate({scrollTop: document.getElementById("chat").scrollHeight + 20}, 820);
}

function getstamp(n) {
	var time = new Date();
	var h = time.getHours();
	var m = time.getMinutes();
	var spaces = "";
	for (si=0; si < (n.length - 5); si++) {
		spaces += "&#160;";
	}
	if (String(h).length === 1) {
		h = "0" + String(h);
	}
	if (String(m).length === 1) {
		m = "0" + String(m);
	}
	return spaces + h + ":" + m;
}

function soundPlay(which) {
	function createSound(which) {
		soundEmbed = document.createElement("audio");
		soundEmbed.setAttribute("type", "audio/webm");
		soundEmbed.setAttribute("src", which);
		soundEmbed.setAttribute("style", "display: none;");
		soundEmbed.setAttribute("autoplay", true);
	}
	if (!soundEmbed) {
		createSound(which);
	}
	else {
		document.body.removeChild(soundEmbed);
		soundEmbed.removed = true;
		soundEmbed = null;
		createSound(which);
	}
	soundEmbed.removed = false;
	document.body.appendChild(soundEmbed);
}

function textcounter(field,cntfield,maxlimit) {
	if (field.value.length > maxlimit) {
		field.value = field.value.substring(0, maxlimit);
	}
	else {
		cntfield.value = maxlimit - field.value.length;
	}
}

function gen(size, extra, s) {
	if (s) {
		Math.seedrandom(Crypto.Fortuna.RandomData(512) + hex_sha512(seed));
	}
	var str = "";
	var charset = "123456789";
	if (extra) {
		charset += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
	}
	str += charset.charAt(Math.floor(Math.random() * charset.length));
	charset += "0";
	while (str.length < size) {
		str += charset.charAt(Math.floor(Math.random() * charset.length));
	}
	return str;
}

function dhgen(key, pub) {
	if (pub === "gen") {
		prikey = str2bigInt(key, 10);
		pubkey = powMod(g, prikey, p);
		return bigInt2str(pubkey, 64);
	}
	else {
		pub = bigInt2str(powMod(str2bigInt(pub, 64), key, p), 64);
		return hex_sha512(pub);
	}
}

function tagify(line) {
	var mime = new RegExp('(data:(application\/((x-compressed)|(x-zip-compressed)|(zip)))|(multipart\/x-zip)).*');
	line = line.replace(/</g,"&lt;").replace(/>/g,"&gt;");
	if ((match = line.match(/((mailto\:|(news|(ht|f)tp(s?))\:\/\/){1}\S+)/gi)) && genurl) {
		for (mc = 0; mc <= match.length - 1; mc++) {
			var sanitize = match[mc].split("");
			for (ii = 0; ii <= sanitize.length-1; ii++) {
				if (!sanitize[ii].match(/\w|\d|\:|\/|\?|\=|\#|\+|\,|\.|\&|\;|\%/)) {
					sanitize[ii] = encodeURIComponent(sanitize[ii]);
				}
			}
			sanitize = sanitize.join("");
			line = line.replace(sanitize, '<a target="_blank" href="' + sanitize + '">' + match[mc] + '</a>');
		}
	}
	else {
		line = line.replace(/(:|=)-?3/gi, '<div class="emoticon" id="e_cat">$&</div>');
		line = line.replace(/(:|=)-?'\(/gi, '<div class="emoticon" id="e_cry">$&</div>');
		line = line.replace(/(:|=)-?o/gi, '<div class="emoticon" id="e_gasp">$&</div>');
		line = line.replace(/(:|=)-?D/gi, '<div class="emoticon" id="e_grin">$&</div>');
		line = line.replace(/(:|=)-?\(/gi, '<div class="emoticon" id="e_sad">$&</div>');
		line = line.replace(/(:|=)-?\)/gi, '<div class="emoticon" id="e_smile">$&</div>');
		line = line.replace(/-_-/gi, '<div class="emoticon" id="e_squint">$&</div>');
		line = line.replace(/(:|=)-?p/gi, '<div class="emoticon" id="e_tongue">$&</div>');
		line = line.replace(/(:|=)-?(\/|s)/gi, '<div class="emoticon" id="e_unsure">$&</div>');
		line = line.replace(/;-?\)/gi, '<div class="emoticon" id="e_wink">$&</div>');
		line = line.replace(/;-?\p/gi, '<div class="emoticon" id="e_winktongue">$&</div>');
		line = line.replace(/\^_?\^/gi, '<div class="emoticon" id="e_yay">$&</div>');
		line = line.replace(/(:|=)-?x/gi, '<div class="emoticon" id="e_shut">$&</div>');
		line = line.replace(/\&lt\;3/g, '<span class="monospace">&#9829;</span>');
	}
	thisnick = line.match(/^[a-z]{1,12}/).toString();
	if (match = line.match(/^[a-z]{1,12}/)) {
		var atmatch = line.match(/^[a-z]{1,12}:\s\@[a-z]{1,12}/);
		if (atmatch && jQuery.inArray(atmatch.toString().substring(thisnick.length + 3), names) >= 0 &&
		(atmatch.toString().substring(thisnick.length + 3) === nick || thisnick === nick)) {
			line = line.replace(/^[a-z]{1,12}\:\s\@[a-z]{1,12}/, '<span class="nick">' + thisnick + ' <span class="blue">&gt;</span> ' +
			atmatch.toString().substring(thisnick.length + 3) + '</span>');  
			if (match = line.match(/data:image\S+$/)) {
				line = line.replace(/data:image.+/, '<a onclick="display(\'' + match + '\', \'' + getstamp(5) + '\', 1)">view encrypted image</a>');
			}
			else if (match = line.match(mime)) {
				line = line.replace(mime, '<a onclick="display(\'' + match[0] + '\', \'' + getstamp(5) + '\', 0)">download encrypted .zip file</a>');
			}
		}
		else {
			var stamp = getstamp(match[0]);<commit_msg>Small tweak<commit_after>var seed = Math.seedrandom();

var p = 
"FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1" +
"29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD" +
"EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245" +
"E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED" +
"EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE45B3D" +
"C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8 FD24CF5F" +
"83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D" +
"670C354E 4ABC9804 F1746C08 CA18217C 32905E46 2E36CE3B" +
"E39E772C 180E8603 9B2783A2 EC07A28F B5C55DF0 6F4C52C9" +
"DE2BCBF6 95581718 3995497C EA956AE5 15D22618 98FA0510" +
"15728E5A 8AAAC42D AD33170D 04507A33 A85521AB DF1CBA64" +
"ECFB8504 58DBEF0A 8AEA7157 5D060C7D B3970F85 A6E1E4C7" +
"ABF5AE8C DB0933D7 1E8C94E0 4A25619D CEE3D226 1AD2EE6B" +
"F12FFA06 D98A0864 D8760273 3EC86A64 521F2B18 177B200C" +
"BBE11757 7A615D6C 770988C0 BAD946E2 08E24FA0 74E5AB31" +
"43DB5BFC E0FD108E 4B82D120 A9210801 1A723C12 A787E6D7" +
"88719A10 BDBA5B26 99C32718 6AF4E23C 1A946834 B6150BDA" +
"2583E9CA 2AD44CE8 DBBBC2DB 04DE8EF9 2E8EFC14 1FBECAA6" +
"287C5947 4E6BC05D 99B2964F A090C3A2 233BA186 515BE7ED" +
"1F612970 CEE2D7AF B81BDD76 2170481C D0069127 D5B05AA9" +
"93B4EA98 8D8FDDC1 86FFB7DC 90A6C08F 4DF435C9 34063199" +
"FFFFFFFF FFFFFFFF";

var p = str2bigInt(p.replace(/\s/g, ''), 16);
var g = str2bigInt("2", 10);
var z = []; for (var i=0; i!==274; i++) { z[i] = 0; } z[272] = 1;

var num = sound = pos = tag = prikey = pubkey = last = 0;
var cfocus = true;
var soundEmbed = null;
var nick = $("#nick").html();
var name = $("#name").html();
var seq_s = [];
var seq_r = [];
var keys = [];
var names = [];
var queue = [];
var seckeys = [];
var usedhmac = [];
var inblocked = [];
var outblocked = [];
var fingerprints = [];

var notice = [
"Cryptocat is supported by people like you. Check out our <a href=\"https://crypto.cat/donate/\" target=\"_blank\">fundraiser</a> and keep us going.",
"Help Cryptocat become better - please <a href=\"https://crypto.cat/donate/\" target=\"_blank\">donate</a> by buying Cryptocat stickers!",
"Cryptocat is an open software effort. Your <a href=\"https://crypto.cat/donate/\" target=\"_blank\">donations</a> help us improve.",
"You can donate to Cryptocat using Bitcoin! Please <a href=\"https://crypto.cat/donate/\" target=\"_blank\">contribute</a> and keep us going.",
"Cryptocat is volunteer-run and handles thousands of conversations a week. Please <a href=\"https://crypto.cat/donate/\" target=\"_blank\">donate</a> today."
];

function scrolldown() {
	$("#chat").animate({scrollTop: document.getElementById("chat").scrollHeight + 20}, 820);
}

function getstamp(n) {
	var time = new Date();
	var h = time.getHours();
	var m = time.getMinutes();
	var spaces = "";
	for (si=0; si < (n.length - 5); si++) {
		spaces += "&#160;";
	}
	if (String(h).length === 1) {
		h = "0" + String(h);
	}
	if (String(m).length === 1) {
		m = "0" + String(m);
	}
	return spaces + h + ":" + m;
}

function soundPlay(which) {
	function createSound(which) {
		soundEmbed = document.createElement("audio");
		soundEmbed.setAttribute("type", "audio/webm");
		soundEmbed.setAttribute("src", which);
		soundEmbed.setAttribute("style", "display: none;");
		soundEmbed.setAttribute("autoplay", true);
	}
	if (!soundEmbed) {
		createSound(which);
	}
	else {
		document.body.removeChild(soundEmbed);
		soundEmbed.removed = true;
		soundEmbed = null;
		createSound(which);
	}
	soundEmbed.removed = false;
	document.body.appendChild(soundEmbed);
}

function textcounter(field,cntfield,maxlimit) {
	if (field.value.length > maxlimit) {
		field.value = field.value.substring(0, maxlimit);
	}
	else {
		cntfield.value = maxlimit - field.value.length;
	}
}

function gen(size, extra, s) {
	if (s) {
		Math.seedrandom(Crypto.Fortuna.RandomData(512) + hex_sha512(seed));
	}
	var str = "";
	var charset = "123456789";
	if (extra) {
		charset += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
	}
	str += charset.charAt(Math.floor(Math.random() * charset.length));
	charset += "0";
	while (str.length < size) {
		str += charset.charAt(Math.floor(Math.random() * charset.length));
	}
	return str;
}

function dhgen(key, pub) {
	if (pub === "gen") {
		prikey = str2bigInt(key, 10);
		pubkey = powMod(g, prikey, p);
		return bigInt2str(pubkey, 64);
	}
	else {
		pub = bigInt2str(powMod(str2bigInt(pub, 64), key, p), 64);
		return hex_sha512(pub);
	}
}

function tagify(line) {
	var mime = new RegExp('(data:(application\/((x-compressed)|(x-zip-compressed)|(zip)))|(multipart\/x-zip)).*');
	line = line.replace(/</g,"&lt;").replace(/>/g,"&gt;");
	if ((match = line.match(/((mailto\:|(news|(ht|f)tp(s?))\:\/\/){1}\S+)/gi)) && genurl) {
		for (mc = 0; mc <= match.length - 1; mc++) {
			var sanitize = match[mc].split("");
			for (ii = 0; ii <= sanitize.length-1; ii++) {
				if (!sanitize[ii].match(/\w|\d|\:|\/|\?|\=|\#|\+|\,|\.|\&|\;|\%/)) {
					sanitize[ii] = encodeURIComponent(sanitize[ii]);
				}
			}
			sanitize = sanitize.join("");
			line = line.replace(sanitize, '<a target="_blank" href="' + sanitize + '">' + match[mc] + '</a>');
		}
	}
	else {
		line = line.replace(/(:|=)-?3/gi, '<div class="emoticon" id="e_cat">$&</div>');
		line = line.replace(/(:|=)-?'\(/gi, '<div class="emoticon" id="e_cry">$&</div>');
		line = line.replace(/(:|=)-?o/gi, '<div class="emoticon" id="e_gasp">$&</div>');
		line = line.replace(/(:|=)-?D/gi, '<div class="emoticon" id="e_grin">$&</div>');
		line = line.replace(/(:|=)-?\(/gi, '<div class="emoticon" id="e_sad">$&</div>');
		line = line.replace(/(:|=)-?\)/gi, '<div class="emoticon" id="e_smile">$&</div>');
		line = line.replace(/-_-/gi, '<div class="emoticon" id="e_squint">$&</div>');
		line = line.replace(/(:|=)-?p/gi, '<div class="emoticon" id="e_tongue">$&</div>');
		line = line.replace(/(:|=)-?(\/|s)/gi, '<div class="emoticon" id="e_unsure">$&</div>');
		line = line.replace(/;-?\)/gi, '<div class="emoticon" id="e_wink">$&</div>');
		line = line.replace(/;-?\p/gi, '<div class="emoticon" id="e_winktongue">$&</div>');
		line = line.replace(/\^(_|-)?\^/gi, '<div class="emoticon" id="e_yay">$&</div>');
		line = line.replace(/(:|=)-?x/gi, '<div class="emoticon" id="e_shut">$&</div>');
		line = line.replace(/\&lt\;3/g, '<span class="monospace">&#9829;</span>');
	}
	thisnick = line.match(/^[a-z]{1,12}/).toString();
	if (match = line.match(/^[a-z]{1,12}/)) {
		var atmatch = line.match(/^[a-z]{1,12}:\s\@[a-z]{1,12}/);
		if (atmatch && jQuery.inArray(atmatch.toString().substring(thisnick.length + 3), names) >= 0 &&
		(atmatch.toString().substring(thisnick.length + 3) === nick || thisnick === nick)) {
			line = line.replace(/^[a-z]{1,12}\:\s\@[a-z]{1,12}/, '<span class="nick">' + thisnick + ' <span class="blue">&gt;</span> ' +
			atmatch.toString().substring(thisnick.length + 3) + '</span>');  
			if (match = line.match(/data:image\S+$/)) {
				line = line.replace(/data:image.+/, '<a onclick="display(\'' + match + '\', \'' + getstamp(5) + '\', 1)">view encrypted image</a>');
			}
			else if (match = line.match(mime)) {
				line = line.replace(mime, '<a onclick="display(\'' + match[0] + '\', \'' + getstamp(5) + '\', 0)">download encrypted .zip file</a>');
			}
		}
		else {
			var stamp = getstamp(match[0]);
{'fraction_non_alphanumeric': 0.21947854876534695, 'fraction_numerical': 0.10001379500620776, 'mean_word_length': 4.510832383124288, 'pattern_counts': {'":': 2, '<': 109, '<?xml version=': 0, '>': 105, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 8, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7601762', 'n_tokens_mistral': 7177, 'n_tokens_neox': 6104, 'n_words': 1154}