Skip to content

Instantly share code, notes, and snippets.

@andrewpisula
Last active November 4, 2021 21:07
Show Gist options
  • Save andrewpisula/7b44d06a71e27f7b5afef05ead53cc14 to your computer and use it in GitHub Desktop.
Save andrewpisula/7b44d06a71e27f7b5afef05ead53cc14 to your computer and use it in GitHub Desktop.
Very crude homemade encryption I made in my free time.
using System;
using System.Text;
namespace encryption_poc_lol
{
class Program
{
// Written by Mysteriousss in 30 minutes on 11/2/2021. Uploading this to GitHub at 10:04 PM
// Discord : ζ͜͡๖ۣmysteriou็็็s็็็ss#4579
// This could definitely be improved apon, I just wrote this in my free time for fun as a POC. This is by no means a secure algorithm.
static char Spacer = 'x';
static void Main(string[] args)
{
Console.Write("Enter Text to encrpyt: ");
string input = Console.ReadLine();
Console.Write("Enter Key: ");
int Key = Int32.Parse(Console.ReadLine());
Console.WriteLine("Encrypted : " + Encrypt(input, Key));
Console.WriteLine("Decrypted : " + Decrypt(Encrypt(input, Key), Key));
}
static string Encrypt(string Input, int Key)
{
string Output = string.Empty;
foreach (byte enc in Encoding.ASCII.GetBytes(Input))
{
//Console.WriteLine(enc + "*" + Key + "=" + enc * Key);
Output += enc * Key + Spacer.ToString();
}
return Output;
}
static string Decrypt(string Input, int Key)
{
string Output = string.Empty;
foreach (string part in Input.Split(Spacer))
{
if (part.Length != 0)
{
Output += Convert.ToChar(Int32.Parse(part) / Key);
}
}
return Output;
}
}
}
/*
Example Output :
Enter Text to encrpyt: Mysteriousss
Enter Key: 32
Encrypted : 2464x3872x3680x3712x3232x3648x3360x3552x3744x3680x3680x3680x
Decrypted : Mysteriousss
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment