Skip to content

3.Caesar Cryptography

Lucas Eschechola edited this page Dec 8, 2021 · 6 revisions

Here's an example of how to use the Caesar Cipher encryption algorithm using the EscNet micro framework

First configure your dependency in your Startup.cs

services.AddCaesarCipherCryptography(KEY_UP);



Now receive your dependency via constructor.

private readonly ICaesarCipherCryptography _caesarCipherCryptography;

public MyClass(ICaesarCipherCryptography caesarCipherCryptography){
    _caesarCipherCryptography = caesarCipherCryptography;
}



Now to encrypt the phrase use

string encryptedPhrase = _caesarCipherCryptography.Encrypt("phrase to be encrypted");



And to decrypt the phrase use

string decryptedPhrase = _caesarCipherCryptography.Decrypt("phrase to be decrypted");




2021 ©


Clone this wiki locally