Skip to content

Instantly share code, notes, and snippets.

View GiovanniMounir's full-sized avatar

Giovanni Mounir GiovanniMounir

View GitHub Profile
@GiovanniMounir
GiovanniMounir / crack_vigenere.php
Last active June 4, 2021 14:01
Crack Vigenere using index of coincidence and Chi-Square (X2) in PHP
<?php
/* Methods based on "Introduction to Modern Cryptography" by Jonathan Katz/Yehuda Lindell and as explained by Dr. Ching-Kuang Shene: https://pages.mtu.edu/~shene/NSF-4/Tutorial/VIG/Vig-IOC.html */
$frequency =
[
"A" => 8.2,
"B" => 1.5,
"C" => 2.8,
"D" => 4.3,
"E" => 12.7,
@GiovanniMounir
GiovanniMounir / banker.cpp
Created April 20, 2019 20:18
Banker's algorithm for OS (Safety Algorithm; C++)
/*
CLI output inspired by https://gist.github.com/Dammonoit/a77154b7bc688ef25298be79b5ea99fb (@Dammonoit on GitHub)
Safety criteria logic from https://www.geeksforgeeks.org/program-bankers-algorithm-set-1-safety-algorithm/
*/
#include <stdio.h>
int **initialize2D(int n, int m)
{
int **_A = new int *[n];
for (int i = 0; i < n; ++i)
_A[i] = new int[m];
ReadConnection = new MySqlConnection("Server='server';Database='" + mysqlDatabase + "';Username='" + mysqlUser + "';Password='" + mysqlPassword + "'");
ReadConnection.Open();
Connected = true;
WriteConnection = new MySqlConnection("Server='server';Database='" + mysqlDatabase + "';Username='" + mysqlUser + "';Password='" + mysqlPassword + "'");
WriteConnection.Open();
Refreshdown = 0;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
namespace GameServer {
class Client {
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Diagnostics;