Posts

113+ Collection C# Code Problems for Beginners

Image
Most of the time, Technical interview ruined the dreams of developers. These interviews are designed to test the developer's critical thinking and real-world problem-solving skills in several situations where they may come into play while on the job. For beginners, the situation is even painful. As they are not fully aware of the industry code problems and code challenges. So it's difficult for beginners in the technical interview to answer code problems in the fixed time. Code problems and code challenges help developers to become confident in the programming language, develop problem-solving skills, debugging skills, and gain more knowledge of the language. As a beginner, the developer should spend a good time on learning language, various algorithms, and data structure. To gain more hands-on experience developers need to solve code problems and code challenges. The code problems do not help directly to resolve real-times issues but they help ...

learn new things on core voila

When you start learning new things actually starting developein Core voila is my small intimate inciative to learn and foucs to understand core concepts related computer. In this blog you will get the information about all Cryptography algorithm, C# tutorials, .net version and code project. This blog has moved to its own domain tohttps://corevoila.in/  So leave new things, stay fit and stay healthy

Symmetric Cryptography

Image
This is the simplest kind of Cryptography that involves only one secret key to encrypt and decrypt information . It is also known as “Secret Key Cryptography”. Both Sender and receiver should know the key to be able to communicate securely. For Example: if Mahesh & Shalini wants to communicate using symmetric-key cryptography then both would have to devise key and use it for every communication. So Now, Mahesh encrypts his message using shared key, sends encrypted message to Shalini , then Shalini uses the same key again decrypt message to read. To demonstration symmetric-key cryptography , I will use AES ( Advanced Encryption Standard ) & .Net Framework in-build library “ System.Security.Cryptograph ” Output:

Asymmetric Cryptography (Public Key Cryptography) - Part I

Asymmetric cryptography, also known as public key cryptography, it uses two distinct, yet related keys. One key, the Public Key, is used for encryption and the other, the Private Key, is for decryption. Let say Mahesh wants to send an encrypted message to Shalini , Mahesh will look for Shalini Public key and use it for encrypt the message before sending it. Then Shalini Can decrypt the message using her related private key. if Mahesh encrypts the message using his private key, then the message can be decrypted only using Shalini's public key, thus it will also authenticate Shalini . These encryption and decryption processes happen automatically hence no need to share the keys. Asymmetric cryptography is slower then symmetric cryptography Advantages: 1. Does not require to share key 2. Simple structure RSA is common asymmetric algorithm, I will use the same for this example. To demonstrate, I have used .Net framework in build library “System.Security.Cryptograph...

Basic of Cryptography (Type of Cryptography)- Part II

Image
Cryptography Types Cryptography categorized based on number of keys used for encryption and decryption; in this article we will discuss below three types Secret Key Cryptography - It is also call symmetric encryption where for both encryption and decryption uses same key. This is mainly used for confidentiality. Public Key Cryptography - It is also called asymmetric encryption ; this algorithm uses two key's one for encryption and one for decryption. mainly used for authentication. Hash Function - It uses to convert to text in such way that the input cannot be recoverable by using mathematical function.

Caesar Cipher (Cracking Caesar Cipher with the Brute-Force Technique) - Part II

Image
In Part I , I have written code to encrypt the plain text for demonstration purpose . In this article we will use Brute Force technique to decrypt the encrypted message. Note: please make sure to read articles  Brute force and Caesar Cipher  before this article. Above code produce below  result, the above code took 17 iteration  to get the actual message.

Caesar Cipher Source Code - Part I

Image
The Caesar cipher is one of the earliest known and simplest ciphers; Created and used in 44 BC by Julius Caesar. It is a type of substitution cipher in which each letter in the plain text is 'shifted' with certain number of places in the alphabet. For example, if we right shift the alphabets by 3 char then we get the below text; So now if we encrypt the message with above "TEST MESSAGE" will show below result The encryption can be represented Mathematical, by first transforming the letters into numbers, like  A = 0, B = 1,…, Z = 25. To represent the Caesar Cipher encryption function, e(x), where x is the character we are encrypting, as: E(X) = (X+K)  (mod 26)  Where K represents key used to shift the letters in alphabets. for decryption we can use below equation  E(X) = (X-K)  (mod 26) I have written the below code which accept user input and right shift the alphabets by 9 char: Result produce by o...

Brute Force - Part I

Image
Brute force is a straight forward strategy to solving a problem, it’s also called as ‘Exhaustive Search’ in which you try all possibilities to reach solution of a problem. In Brute force attack, attacker systematically checks all possible passwords and passphrases until the correct one is found. Alternatively, the attacker can attempt to guess the key, which is typically created from the password using a key derivation function. This is known as an  exhaustive key search . Let’s say password has eight alphanumeric characters which includes uppercase and lowercase letters. The possible character set we will be use 26 x 2 alphabets (ucase + lcase) = 52 characters. So it will take 52 8  attempts to crack the password. As per Stricture Consulting Group,  25-GPU cluster achieved a brute force attack with speed of 350 billion guesses per second, allowing them to check 95 8    password combinations in 5.5 hours.

SHA-256(Source Code in C# using .Net in-built Cryptography library) - Part II

.Net Framework provides in built support for various hash functions like MD-5, SHA-1, SHA-256 etc... ComputeHash method Computes the hash value to the specified byte array. Below are the overloaded methods to Compute Hash using SHA-256 class in System.Security.Cryptography  library public byte [] ComputeHash( byte [] buffer) public byte [] ComputeHash( Stream inputStream) public byte [] ComputeHash( byte [] buffer, int offset, int count)

SHA-256(Source Code in C#) - Part I

SHA-256 (Secure Hash Algorithm) , is one of the cryptographic hash function, commonly used in Blockchain. It generates an almost-unique 256-bit (32-byte) signature for a text.  SHA-256 is successor hash functions to SHA-1. it is one of the strongest hash functions available and has not yet been compromised in any way.   Here is source code written in  C#. I will try to give more details in next Part II

What do you mean by Hashing?

Hashing is process of converting any size of data into fix size of data by performing mathematical operations. A message to be hashed is called input; the Algorithm is used to do so is called hash function; the output is called hash value. There are many algorithm which used to generate hash value like MD5, SHA-1, SHA-256, Tiger etc.  Hash function generates a unique value, this means two input always generates different hash value.    Hash value can not be decrypt once it's hashed, this is the difference between encryption and hash. Encrypted value can be decrypt using keys but we can not extract input from Hash value. Common use of Hash is to store password into database. 

Basic of Cryptography - Part I

Cryptograph means secret writing, in order to make information secret we use cipher, an algorithm that converts plain text to cipher-text. Cipher has been used long before computer existance. In 44 BC  Julius Caesar uses the technique now called Caeser Cipher  to send message. He used to shfit the letter by 3 character.  Another great example from history, Nazis Enigma Machine used during war to translate message. Data Encryption Standard (DES) is the first algorithm written for Cryptography in early 19th century. A process of making text secret is called Encryption and the reverse process is called Decryption. So far the Cryptography technique we mentioned  above relies on keys known by sender and receiver. Though manual sharing key is not good idea, solutions is to automate exchange of keys. We can do this by using one way functions , to understand one way function here is the Good example of one way function is Diffie-Hellman key exchange . ...