Giter VIP home page Giter VIP logo

cryptocsharp's Introduction

Cryptography

C# lib to encrypt and decrypt data with symmetric/asymmetric algorithms

Asymmetric

The asymmetric portion of the Cryptography library lets you create and use public and private keys.

Create Keys

// This will create both a public and private key with a 4096 key-size.
// You can specify your own key-size as the third parameter to the function.
if (Cryptography.Asymmetric.RSA.CreateKeys(
    out string publicKey,
    out string privateKey)) {
  // Do something fancy with the keys, but
  // keep the private one secret and safe.
}

Encrypt

var encryptedBytes = Cryptography.Asymmetric.RSA.Encrypt(plainBytes, publicKey);

Decrypt

var decryptedBytes = Cryptography.Asymmetric.RSA.Decrypt(encryptedBytes, privateKey);

Symmetric

The symmetric portion of the Cryptography library lets you encrypt and decrypt large-scale data using a password.

Encrypt

// This will encrypt data using Rijndael.
var encryptedBytes = Cryptography.Symmetric.Encrypt(plainBytes, password);

// You can specify your own symmetric algorithm, like so..
var encryptedBytes = Cryptography.Symmetric.Encrypt<RijndaelManaged>(plainBytes, password);

Decrypt

// This will decrypt data using Rijndael.
var decryptedBytes = Cryptography.Symmetric.Decrypt(encryptedBytes, password);

// As with encrypt, you can specify your own symmetric algorithm, like so..
var decryptedBytes = Cryptography.Symmetric.Decrypt<RijndaelManaged>(encryptedBytes, password);

Iterations, KeySize, and Salt

The iterations, key-size, and salt variables are pre-defined in this library, but you can easily change them.

Cryptography.Symmetric.Iterations = 4; // defaults to 2

Cryptography.Symmetric.KeySize = 196; // defaults to 256.

Cryptography.Symmetric.Salt = { ... }; // see source-code for default ;)

cryptocsharp's People

Contributors

nagilum avatar

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.