2

I have been reading up on encryption algorithms and am trying to implement them with my research without using any libraries. However, I am finding it a bit difficult to understand how they work.

The algorithms I have looking at in particular are,

triple des - uses 3 keys, 1st to encrypt, 2nd to decrypt and third to encrypt again

RSA - uses large positive integers to generate encryption and decryption e.g., e,d and n

AES - uses substitution permutation with fixed blocks of bits and key size.

I have searched online and came across many libraries like cryptoJS, OpenPGP and cryptico but am finding it hard to follow the code - because of being new to them.

I understand the main idea behind them but finding it difficult to put in code, please can someone guide me - is there any psuedo code/psuedo algorithm that I can use or make reference to when implementing.

Jackie
  • 427
  • 1
  • 9
  • 19
  • Take a look at the internals of C# BouncyCastle. While there is practically no documentation, there is quite a bit of code commenting, and quite clear code. – Sentinel Jul 15 '18 at 22:46
  • A good (secure) encryption implementation is probably not going to be straight forward as it will be designed to avoid timing attacks. – zaph Jul 15 '18 at 22:57
  • I agree @zaph I just want to get rough pesudo to get me started - it doesn't need to be a full implementation of the encryption techniques as I understand it can be quite lengthy and time consuming – Jackie Jul 15 '18 at 22:59
  • @Jackie if you search for pseudocode for each algorith, you will get a plenty of answers, so - what exactly do you have problem with? Or may as well ask on [crypto](https://crypto.stackexchange.com/) though I advice to have a very specific question there – gusto2 Jul 16 '18 at 22:34

1 Answers1

3

I have implemented AES and DES on Java. For my experience, If you know theory everything is very simple. You can get MIT or Stanford course of cryptography. Anyway first off all you should know theory. After that there are too many implementations at Github. You may even use Youtube to see how algorithm encrypts on sample data.

To be honest I love resources of Ruhr University Bochum. AES/DES are chapter III, IV. This is official web page link. They have recorded video lectures and also free book, named "Understanding cryptography" published by Springer.

P.S BouncyCastle is very popular library. It is very well implemented on Java. You can look at this too.

grep
  • 5,465
  • 12
  • 60
  • 112
  • Thanks for the answer, I myself have came across few of the resource and in some cases the full code as well :) but I want to try implementing them myself because I believe i will learn them better this way – Jackie Jul 15 '18 at 22:56
  • I have seen some of the youtube videos, whilst they do explain the concept and how the algorithm work - I am finding it difficult to put it in code. However, I haven't came across - resources of Ruhr University Bochum and will take a look now! – Jackie Jul 15 '18 at 22:58
  • 5 years ago I was working for the company where we were implementing algorithms. I had the same situation. I spent too much time to understand how the algorithms was working. I think video resources of Ruhr University Bochum is one of the best - easy to understand. Anyway, we are here to help you, if you have any concrete questions about algorithm. Good luck! – grep Jul 15 '18 at 23:03
  • Hi, do you know how I can represent AES in mathematical notation? like triple DES can be represented as ciphertext = EK3(DK2(EK1(plaintext))) and plaintext = DK1(EK2(DK3(ciphertext))) – Jackie Jul 17 '18 at 17:21