Skip to content

Instantly share code, notes, and snippets.

@cjavad
Created February 9, 2024 17:08
Show Gist options
  • Save cjavad/cd2abade916d30a9a05441c660c494c6 to your computer and use it in GitHub Desktop.
Save cjavad/cd2abade916d30a9a05441c660c494c6 to your computer and use it in GitHub Desktop.
Quickly lookup lifetime stats on ICTF discord bot IQ to troll peeps.
using System;
using System.Security.Cryptography;
using System.Linq;
using System.Text;
public class Program
{
public static void Main()
{
int[] res = Max(393489189116837918);
Console.WriteLine( "Max IQ: " + res[0].ToString() + " in month " + res[1].ToString() + " Min IQ: " + res[2] + " in month " + res[3] + " with an average IQ of " + res[4].ToString() );
}
public static int[] Max(ulong id) {
int max = 0;
int maxM = 0;
int min = int.MaxValue;
int minM = 0;
int avg = 0;
for (int i = 0; i < 12; i++) {
int cur = Func(id, (i+1).ToString());
if (cur > max) {
max = cur;
maxM = i + 1;
}
if (cur < min) {
min = cur;
minM = i + 1;
}
avg = avg + cur;
}
return [max, maxM, min, minM, avg / 12];
}
public static int Func(ulong id, string m) {
string plaintext = "Who?" + id.ToString() + m + "Tao";
byte[] bytes = Encoding.UTF8.GetBytes(plaintext);
byte[] hash = new MD5CryptoServiceProvider().ComputeHash(bytes);
uint random = BitConverter.ToUInt32(hash.Take(4).ToArray());
float x = random / (uint.MaxValue / 10f);
float y = 1 + MathF.Tan((x * MathF.PI) / 20);
int iq = (int)(y * 75);
return iq;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment