Skip to content

Custom symmetric cipher library that I am just building to play with different ways of manipulating data.

License

Notifications You must be signed in to change notification settings

kupokev/EnKrypt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EnKrypt

Custom Cipher library that I am just building to play with different ways of manipulating data. The cipher is a complex shift cipher that shifts the hex digits of characters in the text in a multiple dimensional shift.

This is my first attempt at a cipher and I realize it is likely not a super strong cipher. I would welcome any feedback on it. I also would not reccomend using it for an application that requires super strong ciphers.

Usage

Using a key

// Set password and message
var password = "Testing#158";
var message = "This is a random test message";

// Show original message
Console.WriteLine("Original Message");
Console.WriteLine(message);

// Generate key from password
var key = EnKrypt.Rubyk.GetKey(password);

// Encrypt the message
var cipher = EnKrypt.Rubyk.Encrypt(message, key);

Console.WriteLine(Environment.NewLine + "Encrypted Message");
Console.WriteLine(cipher);

// Decrypt the message
Console.WriteLine(Environment.NewLine + "Decrypted Message");
Console.WriteLine(EnKrypt.Rubyk.Decrypt(cipher, key));

Using a plain text password

// Set password and message
var password = "Testing#158";
var message = "This is a random test message";

// Show original message
Console.WriteLine("Original Message");
Console.WriteLine(message);

// Encrypt the message
var cipher = EnKrypt.Rubyk.Encrypt(message, password);

Console.WriteLine(Environment.NewLine + "Encrypted Message");
Console.WriteLine(cipher);

// Decrypt the message
Console.WriteLine(Environment.NewLine + "Decrypted Message");
Console.WriteLine(EnKrypt.Rubyk.Decrypt(cipher, password));

Ciphers

Rubyk

The shift was done by first converting characters to their hex value. Once converted to hex, the individual hex values would shift 1 character and then converted bac into characters.

For example:

Kupo = 4B 75 70 6F

Would convert to the following

B7 57 06 F4

Cubes

The cubes are a minimum of 3x3x3. The cubes expand to a size that will contain enough elements to fit each character of the text. So a string up to 27 character will fit in a 3x3x3. Between 28 and 64 the cube will be a 4x4x4.

If there are any empty elements in the cube after the plain text has been populated, the rest of the elements will be populated with a character "0". This is so that no element is left empty.

When populated, a cube should look something like the below text

Text: Testing a short string

Layer 0:

    T  t  g

    0  o  0

    r  g  0

Layer 1:

    e  i  0
    
    s  r  s
    
    i  0  0


Layer 2:

    s  n  a
    
    h  t  t
    
    n  0  0

About

Custom symmetric cipher library that I am just building to play with different ways of manipulating data.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages