Advanced Programming of Cryptographic Methods

C Language

  1. The CPU. Two examples of Assembler of 80x86. The OS: Memory Management System, Process Management System. The Java Virtual Machine.
  2. First steps in C and GCC:Stack and Heap; Malloc. How to compile and run a program from a Linux console. Passing paramaters to a program: argc and argv. Programs: Hello and ASCII table, allocating a big array in C. Eratostene with malloc. Two kinds of bidimensional arrays in C. Rotating an array in C.
  3. Bit operators in C. Programs: Printing a word in hexadecimal and binary format, rotate a word, compute the Hamming weight. Tartaglia's triangle: \((x+y)^n\) in \(F_2\). Creation and usage of a library in C.
  4. Struct and dinamic structures. Programs: Queues, Stacks, Lists. Binary Trees in C: a words-counter in C.
  5. Using files in C. Programs : Hexadecimal visualizer of a file; Caesar cipher of an ASCII file; Checking the integrity of a file by XOR and fread.
  6. Stream Cipher and permutations in C: ARC4. Programs: Setup of ARC4, Pseudorandom generator by ARC4, (de)cipher by ARC4.
  7. Stream Cipher and finite fields: A5/1 and LFSR. Programs: Printing all the non-zero elements of the 3 registers of A5/1 (LFSR); Implementing the majority function and printing the states; (De)cipher with A5/1.
  8. Block cipher: AES128. Programs : Key schedule, Step by step ciphering by SBox, ShiftRows and MixColumns, AES with ECB mode, AES with CBC mode.
  9. Pseudo random number generators (PRNG) and first steps with Gnu Multi Precision arithmetic library (GMP). Programs : Default PRNG by ANSI C, Linear PRNG and its period, Blum Blum Shub PRNG using GMP. Entropy in Linux.
  10. RSA algorithm with GMP. Programs: Private and public key generator, cipher a short message from the console to a file using the public key, decipher the message from the file to the console using CRT and the private key.

Java Language

  1. Java FX and the fxml format.
  2. Communications between C and Java: The JNI interface.
  3. ARC 4 in JNI: PRNG and a Chat using JavaFX. Simulating different instances of objects in C.
  4. Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files.
  5. The Bouncy castle provider.
  6. Symmetric block cipher: DES/AES/ARC4. Mode: ECB/CBC/CTR. Padding: PKCS7. Inline initial vector. Programs: Bytes counter of a file, Hexadecimal visualizer, (de)cipher a file of short and big dimension.
  7. Hash function and HMAC: Tampering a message.
  8. BigInt and pseudo prime generators.
  9. RSA key generation. OAEP Padding. Session key and Iv exchange.
  10. Launching a C program from Java. Sleep in C on different platforms.


  1. B. Kernighan, D. Ritchie, The C programming language, Second edition, Prentice Hall.
  2. A. Beutelspacher, Cryptography in C and C++, Second edition, APress.
  3. GMP Development Team, The GNU Multiple Precision Arithmetic Library, ver 6.1.2.
  4. S. Liang, The Java Native Interface, Programmer's Guide and Specification, Addison-Wesley.
  5. D. Hook, Beginning Cryptography with Java, Wrox Press.