CBDN

CortanaBatch Developer Network

https://cortanabatch.zohosites.com/dev.html

CBDN C# Library

Updated 1th July 2017

OVERVIEW

The CortanaBatch Developer Network C# Library is a bold new experiment in the field of CBDN. Designed for Windows.

SPECIFICATIONS

Designed specifically for Windows. Target .NET Framework:   .Net 4.6.1 

Can be used on any Windows NT later than Windows XP.

To use with Visual Studio, ………

  1. Open Visual Studio.
  2. Click the “Project” Tab.
  3. Click “Add Reference”
  4. Download the Library .dll file from here.
  5. Add it as a reference.
  6. Click OK.
  7. In the top of the code page, right below “using System;”, add  “using CBDN_CS_Library;

Documentation

GMailSMTPMailServiceProvider

Sends mail using Gmail’s SMTP server.

Methods                            Description                                   Parameters

Send();

Sends an email message to a specified email address.

string from, string from_name, string to_name, string to, string password, string message_subject, string message_body, bool isHTML

Send()

___________________________________________________________

        private void button1_Click(object sender, EventArgs e)

        {

            GMailSMTPeMailServiceProvider g = new GMailSMTPeMailServiceProvider();

            g.Send("johnsmith@bla.com", "John Smith", "Rex Locos", "rex lokoso@bla.com", "password-of-JohnSmith", "Hello Rex", “<br /> <p>Hello rex!</p>”, true);

        }

___________________________________________________________

CesarCryptoServiceProvider

Encrypts and Decrypts using the Caesar Cipher.

Methods:                            Description                                 Parameters

Encipher();

Encrypts given text.

string input, int key

Decipher();

Decrypts given text.

string input, int key

Encipher();                 [and]                 Decipher();

___________________________________________________________________________

private void Cesar_Engine()

{

        CesarCryptoServiceProvider c = new CesarCryptoServiceProvider();

        string enciphered = c.Encipher( “the quick brown fox jumped over the lazy dog.”, 6 );

}

private void Cesar_Engine_Decipher()

{

        CesarCryptoServiceProvider c = new CesarCryptoServiceProvider();

        string undecipherd = c.Decipher( “Znk waoiq hxuct lud pasvkj ubkx znk rgfe jum.”, 6 );

}

___________________________________________________________________________

CSMathematicsServiceProvider

Performs basic operations as well as geometric operations.

[Note: no example is available for the following methods.]

Methods:                              Description:                          Parameters:

Multiply();

Multiplies two doubles.

double a, double b

Add();

Adds two doubles.

double a, double b

Subtract();

Subtracts two doubles.

double a, double b

Divide();

Divides two doubles. If one argument is 0, then it will return 0;.

double a, double b

Mod();

Performs modular arithmetic (id est, returns the remainder of the division of two doubles)

double a, double b

Random();

Generates a random integer within the given bounds specified by int min and int max.

int min, int max

Area_Circle();

Returns the area of a circle given the radius.

double radius

Circum_Circle();

Returns the circumference of a circle given the radius.

double radius

get_Diameter();

Returns the diameter of a circle given the radius.

double radius

get_Radius();

Returns the radius of a circle given the area.

double area

get_SurfaceArea_Cube();

Returns the surface area of  cube given the edge.

double edge

get_Volume_Cube();

Returns  surface area  volume of  cube given the edge.

double edge

get_Height_Cylinder();

Gets the height of a cylinder given the radius and area.

double area, double radius

get_Surface_Area_Cylinder();

Returns the surface area of a cylinder given the radius and height.

double radius, double height

get_Volume_Cylinder();

Returns the surface area volume of a cylinder given the radius and height.

double radius, double height

get_Area_Eclipse();

Returns the Area of an ellipse given the two axises.

double axis_a, double axis_b

get_Circumference_Eclipse();

Does a Big Calculation and returns the circumference of an ellipse given the two axises.

double axis_a, double axis_b

MonoalphabeticCryptoServiceProvider

Encrypts using a monoalphabetic cipher.

In essence, it replaces [ e.g. “a”] with [e.g. “#”].

Methods:                             Description:                                 Parameters:

Engine();

Encrypts using the monoalphabetic cipher.

Details: pass the text to be encrypted or decrypted as a string to Engine(); then specify the encrypted alphabet as a char[] array and specify whether to encrypt or decrypt using the bool.

If the char[] array is left null, the Engine will use its on char[] array

string text,

char[] encrypted_alphabet, bool encrypt

Engine();

In the following example, the method Engine(); encrypts “the quick brown……...over the the lazy dog” to “☩弈꜀ ⾹☕鰳π畆 இ∫☢༖ ꜁∫♞ 鳓☕།⭗꜀ང ∫☻꜀ ☩弈꜀ 唐㑓❅☭ ང∫꜂”.

(Check it out for yourself: these abnormal characters are due the the char[] array in the example. Those values are actually Unicode characters.)

The engine replaces “t” with the 20th value in the array (because t is the 20th letter), which happens to be “☩”. Similaritly, it will replace “a”, the first letter, to the first value in the array.

___________________________________________________________________________

private void Encrypt(){

MonoalphabeticCryptoServiceProvider m = new MonoalphabeticCryptoServiceProvider();

char[] array = { '\u3453', '\u0B87', 'π', '\u0F44', '\uA700', '\uA701', '\uA702', '\u5F08', '\u9C33', '\u9CD3', '\u7546', '\u5510', '\u0F0D', '\u0F16', '\u222B', '\u2B57', '\u2FB9', '\u0006', '\u23FA', '\u2629', '\u2615', '\u263B', '\u2622', '\u265E', '\u262D', '\u2745' };

m.Engine(“the quick brown fox jumped over the lazy dog”, array, true);

}

private void Decrypt(){

MonoalphabeticCryptoServiceProvider m = new MonoalphabeticCryptoServiceProvider();

char[] array = { '\u3453', '\u0B87', 'π', '\u0F44', '\uA700', '\uA701', '\uA702', '\u5F08', '\u9C33', '\u9CD3', '\u7546', '\u5510', '\u0F0D', '\u0F16', '\u222B', '\u2B57', '\u2FB9', '\u0006', '\u23FA', '\u2629', '\u2615', '\u263B', '\u2622', '\u265E', '\u262D', '\u2745' };

m.Engine(“☩弈꜀ ⾹☕鰳π畆 இ∫☢༖ ꜁∫♞ 鳓☕།⭗꜀ང ∫☻꜀ ☩弈꜀ 唐㑓❅☭ ང∫꜂”, array, false);

}

___________________________________________________________________________

RSAAlgorithimCryptoServiceProvider

At the moment, RSAAlgorithimCryptoSeviceProvider is disabled for use other than Arrolle.

VigenereCryptoServiceProvider

Encrypts and decrypts using the Vigenere Cipher.

Engine();

Encrypts / Decrypts given the text to encrypt / decrypt, the Vigenere key, and the rotation. (See example for instructions on using “int rotation”.

string txt, string key, int rotation

Engine();

Instructions on using int rotation: When encrypting, set the int as “1”; when decrypting, set it as “-1”. And when you are just lolling about on the floor, then set it to “0” and let it throw an ArgumentException at you.

___________________________________________________________________________

private void Encrypt()

{

        VigenereCryptoServiceProvider v = new VigenereCryptoServiceProvider();

        string enciphered = v.Engine( “hello world!”, “SERCRET”, 1 );

}

private void Decrypt()

{

        VigenereCryptoServiceProvider v = new VigenereCryptoServiceProvider();

        string decipherd = v.Decipher( “zincs pgvnu!”, “SERCRET”, 1 );

}

___________________________________________________________________________