Skip to content

Instantly share code, notes, and snippets.

@mmorton
Created August 29, 2025 01:12
Show Gist options
  • Save mmorton/304638741ceac820cd26707f6182e243 to your computer and use it in GitHub Desktop.
Save mmorton/304638741ceac820cd26707f6182e243 to your computer and use it in GitHub Desktop.
I reverse engineered the algo a long long time ago... but like right here.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
namespace Program
{
public class RightNowEncryptionAlgorithm
{
private byte GetBaseValue(byte input)
{
return (byte)~(input << 1);
}
private byte GetInverseBaseValue(byte input)
{
input = (byte)~input;
input = (byte)(input >> 1);
return input;
}
private byte GetSeedValue(byte input, int outIndex)
{
return (byte)(((input << 1) ^ 2) ^ ((outIndex / 2) * 4));
}
private byte GetInverseSeedValue(byte input, int sourceIndex)
{
return (byte)((input ^ ((sourceIndex / 2) * 4) ^ 2) >> 1);
}
private int GetOutIndex(int inIndex)
{
return ((inIndex + 1) - ((inIndex % 2) * 2));
}
public byte[] Encrypt(string plain)
{
try
{
string text = plain;
byte[] output = new byte[text.Length];
int count = output.Length;
if (count % 2 != 0)
{
output[count - 1] = GetBaseValue((byte)text[count - 1]);
count = count - 1;
}
for (int i = 0; i < count; i++)
{
int outIndex = GetOutIndex(i);
if (i % 2 == 0)
output[outIndex] = GetBaseValue((byte)text[i]);
else
output[outIndex] = GetSeedValue((byte)text[i], outIndex);
}
return output;
}
catch (Exception)
{
throw;
}
}
public string Decrypt(byte[] crypt)
{
try
{
byte[] source = crypt;
byte[] output = new byte[source.Length];
int count = output.Length;
if (count % 2 != 0)
{
output[count - 1] = GetInverseBaseValue(source[count - 1]);
count = count - 1;
}
for (int i = 0; i < count; i++)
{
int outIndex = GetOutIndex(i);
if (i % 2 == 0)
output[outIndex] = GetInverseSeedValue(source[i], i);
else
output[outIndex] = GetInverseBaseValue(source[i]);
}
return Encoding.ASCII.GetString(output);
}
catch (Exception)
{
throw;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment