<commit_before>var ipc = require('node-ipc');
var crypto = require('crypto');

ipc.config.silent = true;

var password = "<PASSWORD>";
var secret = "";

ipc.serveNet('127.0.0.1', 4895, function() {

    ipc.server.on('PROBE:MSG', function(data, socket) {
        ipc.server.emit(socket, "ALIVE:MSG", {});
    });

    ipc.server.on('MONITOR:MSG', function(msg, socket) {
        console.log(msg.data.line);
        socket.destroy();
        ipc.server.stop();
    });

    ipc.server.on('KLYNG:MSG', function(msg, socket) {
        console.log(msg.data);
        socket.destroy();
        ipc.server.stop();
    });

    ipc.server.on('KEY-EXT:PARAMS', function(data, socket) {
        var dhObj = crypto.createDiffieHellman(data.prime, 'base64');
        var publicKey = dhObj.generateKeys('base64');

        var sharedSecret = dhObj.computeSecret(data.key, 'base64', 'base64');
        secret = sharedSecret;

        console.log(sharedSecret);

        ipc.server.emit(socket, 'KEY-EXT:PUBLIC', {key: publicKey});
    });

    ipc.server.on('AUTH', function(data, socket) {
        var decipher = crypto.createDecipher('aes-256-ctr', secret);
        var decrypted = '' + decipher.update(data.payload, 'base64', 'utf8') + decipher.final('utf8');

        ipc.server.emit(socket, 'AUTH:STATUS', {status: decrypted === password});
    });
});

ipc.server.start();
<commit_msg>modified fixture for new encryption logic<commit_after>var ipc = require('node-ipc');
var crypto = require('crypto');
var utils = require('../../../lib/utils');

ipc.config.silent = true;

var password = "<PASSWORD>";
var secret = "";

ipc.serveNet('127.0.0.1', 4895, function() {

    ipc.server.on('PROBE:MSG', function(data, socket) {
        ipc.server.emit(socket, "ALIVE:MSG", {});
    });

    ipc.server.on('MONITOR:MSG', function(msg, socket) {
        console.log(msg.data.line);
        socket.destroy();
        ipc.server.stop();
    });

    ipc.server.on('KLYNG:MSG', function(msg, socket) {
        console.log(msg.data);
        socket.destroy();
        ipc.server.stop();
    });

    ipc.server.on('KEY-EXT:PARAMS', function(data, socket) {
        var dhObj = crypto.createDiffieHellman(data.prime, 'base64');
        var publicKey = dhObj.generateKeys('base64');

        var sharedSecret = dhObj.computeSecret(data.key, 'base64', 'base64');
        secret = sharedSecret;

        console.log(sharedSecret);

        ipc.server.emit(socket, 'KEY-EXT:PUBLIC', {key: publicKey});
    });

    ipc.server.on('AUTH', function(data, socket) {
        var decrypted = utils.verify(data, secret);
        ipc.server.emit(socket, 'AUTH:STATUS', {status: decrypted.data === password});
    });
});

ipc.server.start();

{'fraction_non_alphanumeric': 0.18590925857617116, 'fraction_numerical': 0.015861305791220952, 'mean_word_length': 3.0781954887218044, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '4428040', 'n_tokens_mistral': 947, 'n_tokens_neox': 900, 'n_words': 150}