Skip to content

Instantly share code, notes, and snippets.

@FleshMobProductions
Created August 14, 2019 05:21
Show Gist options
  • Save FleshMobProductions/fb6a68e3d4fa5a3789ab14e366ae6f4a to your computer and use it in GitHub Desktop.
Save FleshMobProductions/fb6a68e3d4fa5a3789ab14e366ae6f4a to your computer and use it in GitHub Desktop.
C# Port of the Bruh Crypt algorithm from the Cherno Discord Server
using System;
using System.Text;
public static class BruhCrypt {
public static string BruhEncrypt(string input) {
StringBuilder sb = new StringBuilder();
char temp;
for (int i = 0; i < input.Length; i++) {
temp = input[i];
for (int j = 0; j < (int)temp-31; j++) {
sb.Append("bruh");
}
sb.Append("r");
}
return sb.ToString();
}
public static string BruhDecrypt(string input) {
int value = 0;
string dc = string.Empty;
for (int i = 0; i < input.Length - 1; i += 4) {
if (input[i] == 'b') {
if (input[i + 1] == 'r') {
if (input[i + 2] == 'u') {
if (input[i + 3] == 'h') {
value++;
if (input[i + 4] == 'r') {
dc += (char)value+31;
value = 0;
i++;
}
}
}
}
}
else {
throw new ArgumentException(string.Format("Error parsing encrypted string {0}", input));
}
}
return dc;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment