Giter Site home page Giter Site logo

vaccarojohn / ezencryption Goto Github PK

View Code? Open in Web Editor NEW
4.0 0.0 3.0 53 KB

This package provides an easy way to encrypt strings into MD5, SHA1, SHA256, SHA384, SHA512, AES, DES, TripleDES, and RC2 formats. It also provides a way to create your own custom cipher and use it to encrypt strings.

License: MIT License

C# 100.00%
encryption cipher md5 sha1 sha256 sha384 hash output security cryptography

ezencryption's Introduction

EZEncryption

This package provides an easy way to encrypt strings into MD5, SHA1, SHA256, SHA384, and SHA512 formats. It also provides a way to create your own custom cipher and use it to encrypt strings. This package is compiled for .NET 4.7, 4.6.1, 4.5.2, 4.5.1, 4.5, 4.4, and 3.5. The version for 3.5 works with Unity.

Note:

For security reasons, an open-source version of EZEncryption is not provided.

REMEMBER:

The Default Setting For Hash.UseUpperCasing is true. Change that to false, and all MD5, SHA1, SHA256, SHA385, SHA512, and Custom Ciphers generated with EZEncryption will have no capital letters.

Updates

  • 8/7/2017 - EZEncryption Now Supports Symmetric Hashes! (Built In Support For AES, DES, TripleDES, and RC2 Symmetric Hashes) Scroll Down To Example 4 To See How To Use Them!

Example 1 (Using The Default Encryption Methods):

using System;
using EZEncryption;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            Hash myHash = Hash.CreateHash("yourInput", EncryptionType.MD5);
            Console.WriteLine(myHash.OutputAsString);
            myHash = Hash.CreateHash("yourInput", EncryptionType.SHA1);
            Console.WriteLine(myHash.OutputAsString);
            myHash = Hash.CreateHash("yourInput", EncryptionType.SHA256);
            Console.WriteLine(myHash.OutputAsString);
            myHash = Hash.CreateHash("yourInput", EncryptionType.SHA384);
            Console.WriteLine(myHash.OutputAsString);
            myHash = Hash.CreateHash("yourInput", EncryptionType.SHA512);
            Console.WriteLine(myHash.OutputAsString);
        }
    }
}

Example 2 (Another Way To Use The Default Encryption Methods):

using System;
using EZEncryption;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            Hash myHash = new MD5Hash("yourInput");
            Console.WriteLine(myHash.OutputAsString);
            myHash = new SHA1Hash("yourInput");
            Console.WriteLine(myHash.OutputAsString);
            myHash = new SHA256Hash("yourInput");
            Console.WriteLine(myHash.OutputAsString);
            myHash = new SHA384Hash("yourInput");
            Console.WriteLine(myHash.OutputAsString);
            myHash = new SHA512Hash("yourInput");
            Console.WriteLine(myHash.OutputAsString);
        }
    }
}

Example 3 (Creating Your Own Custom Cipher Function):

using System;
using EZEncryption;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            while(true)
            {
                Console.WriteLine("Enter A String To Be Encoded To My Custom Cipher: ");
                Hash myHash = Hash.CreateCustomHash(Console.ReadLine(), new MyCustomCipher());
                Console.WriteLine(myHash.OutputAsString);
            }
        }
    }
    class MyCustomCipher : ICustomCipher
    {
        public char ConvertChar(char input)
        {
            int result;
            if (input == 'z')
            {
                return '0';
            } else if (input == '9')
            {
                return 'a';
            } else if (int.TryParse(input.ToString(), out result))
            {
                result += 1;
                return char.Parse(result.ToString());
            }
            else
            {
                return (char)(((int)input) + 1);
            }
        }
    }
}

Example 4 (Using Built In Symmetric Hashes):

using System;
using EZEncryption;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter A Password For This Encryption: ");
            string password = Console.ReadLine();
            Console.WriteLine("Enter Some Text To Encrypt: ");
            string text = Console.ReadLine();
            Console.WriteLine("Encrypting...\n");
            AESHash aes = new AESHash(text, password);
            Console.WriteLine("Encrypted Data: " + aes.OutputAsString);
            Console.WriteLine("Decrypting...\n");
            Console.WriteLine("Decrypted Data: " + AESHash.Decrypt(aes.OutputAsByteArray, password));
        }
    }
}

Note: You May Also Use The SymmetricHash.CreateSymmetricHash() Method To Create Symmetric Hashes.

ezencryption's People

Contributors

gamergames123 avatar vaccarojohn avatar

Stargazers

 avatar  avatar  avatar  avatar

ezencryption's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.